Commit Graph

11395 Commits

Author SHA1 Message Date
Richard W.M. Jones
31e6b18710 po: Remove virt-v2v related dependency from POTFILES-ml.
Causes this error if you compile libguestfs 1.42.0 from the tarball
without invoking the generator:

make[4]: *** No rule to make target '../common/mlv2v/uefi.ml', needed by 'libguestfs.pot'.  Stop.
2020-03-09 17:31:55 +00:00
Richard W.M. Jones
da6324ea31 Version 1.42.0. v1.42.0 2020-03-09 14:32:38 +00:00
Richard W.M. Jones
bfe98ffe13 Update release notes for 1.42.
Also update generator/authors.ml so that ‘make maintainer-check-authors’
passes.
2020-03-09 13:35:40 +00:00
Richard W.M. Jones
5a2b191de8 po-docs: Fix translation error in Ukrainian docs.
./uk.po:87712: 'msgid' and 'msgstr' entries do not both begin with '\n'
msgfmt: found 1 fatal error

Fixes commit 7a534669ae.
2020-03-09 13:35:40 +00:00
Richard W.M. Jones
786dba91d1 Revert "lib: Autodetect backing format and specify it explicitly."
This reverts commit 92fd5d5d40.

See discussion here:
https://www.redhat.com/archives/libguestfs/2020-March/thread.html#00041
2020-03-09 12:54:05 +00:00
Richard W.M. Jones
7a534669ae Update translations from Zanata (RHBZ#1787301).
This is before we move to Weblate.  See:
https://bugzilla.redhat.com/show_bug.cgi?id=1787301
2020-03-06 20:08:32 +00:00
Richard W.M. Jones
d107f12ac9 common: Update submodule to latest. 2020-03-06 19:41:02 +00:00
Richard W.M. Jones
0e17236d7d Update copyright dates to 2020. 2020-03-06 19:32:32 +00:00
Richard W.M. Jones
77f8018f6a Update gnulib to latest. 2020-03-06 19:03:03 +00:00
Richard W.M. Jones
18c3f40c60 appliance: Pass root=UUID=<uuid> instead of appliance device name (RHBZ#1804207).
Appliance device names are not reliable since the kernel no longer
enumerates virtio-scsi devices serially.  Instead get the UUID of the
appliance and pass this as the parameter.

Note this requires supermin >= 5.1.18 (from around July 2017).
2020-03-06 19:03:03 +00:00
Richard W.M. Jones
a06262e199 daemon: Print device names when they are translated.
This helps to debug problems with the new device name translation
code.  We can think about removing this later when the code is known
to work well.
2020-03-06 19:03:03 +00:00
Richard W.M. Jones
bca9b94fc5 daemon: Translate device names if Linux device ordering is unstable (RHBZ#1804207).
Linux from around 5.6 now enumerates individual disks in any order
(whereas previously it enumerated only drivers in parallel).  This
means that /dev/sdX ordering is no longer stable - in particular we
cannot be sure that /dev/sda inside the guest is the first disk that
was attached to the appliance, /dev/sdb the second disk and so on.

However we can still use SCSI PCI device numbering as found in
/dev/disk/by-path.  Use this to translate device names in and out of
the appliance.

Thanks: Vitaly Kuznetsov, Paolo Bonzini, Dan Berrangé.
2020-03-06 19:03:03 +00:00
Richard W.M. Jones
92fd5d5d40 lib: Autodetect backing format and specify it explicitly.
In the guestfs_disk_create API we have traditionally allowed you to
set backingfile without setting backingformat.  The meaning of this is
to let qemu autodetect the backing format when opening the overlay
disk.

However libvirt >= 6.0 refuses to even pass such disks to qemu (see
https://bugzilla.redhat.com/show_bug.cgi?id=1798148).

For this reason, move the autodetection earlier and make it explicit.
We now autodetect the format of the backing disk at the time of
creation of the overlay, and set that as the backing format in the
overlay disk itself, allowing libvirt to open the disk later.
2020-03-06 19:03:03 +00:00
Richard W.M. Jones
4e90febbaa RHEL 7: python: Check for _Py_IsFinalizing.
This symbol is not present in Python 2.7 or 3.6.  It's not really
necessary to call this, it just avoids a crash in certain corner cases
when the interpreter is shutting down.  So make the call conditional
on the function existing.

Fixes commit e6f9e0b0f6.
2020-03-06 18:59:52 +00:00
Richard W.M. Jones
6ff1055f40 daemon: 9p: modprobe 9pnet_virtio before 9pfs operations.
Recent Linux kernels seem to require this, for unclear reasons.
2020-03-06 14:50:37 +00:00
Richard W.M. Jones
0eb8d428a2 lib: Fix leak of XPath objects.
These are two unrelated leaks of XPath objects, both found by valgrind.

Fixes commit 9484136fd0
and commit 94843f155a.
2020-03-06 13:10:10 +00:00
Richard W.M. Jones
55401b3f89 valgrind: Add further suppressions for OCaml 4.10.
See also:
c260c25cf0
2020-03-06 12:24:48 +00:00
Richard W.M. Jones
3cea2cfe04 lib: Move guestfs_device_index impl from daemon to library.
This function doesn't work reliably with the proposed change to device
name translation.  The reason is that strings returned by
Devsparts.list_devices contained translated names, so their indexes
did not correspond to the untranslated names used outside the
appliance..

We can avoid this and make the function much simpler and faster by
implementing it on the library side instead.
2020-03-05 13:18:27 +00:00
Richard W.M. Jones
eb17229c3e tests/disks: Don't segfault if guestfs_list_devices returns an error.
Although it's highly unlikely in normal use, while testing device name
translation patches it did happen and caused the test to segfault
instead of exiting with an error.
2020-03-05 12:08:35 +00:00
Richard W.M. Jones
2639de38c1 todo: Remove virt-rescue suggestion which has been done. 2020-03-05 12:02:14 +00:00
Martin Kletzander
8339f766d7 Update the 5 year logo to 10 year logo
Already outdated, but rounded ;)

I literally just opened the 5yrs logo, changed the text and then done:

  inkscape -z -o logo/fish-10yrs.{png,svg}
  cp {logo,website}/fish-10yrs.svg

and then updated the rest of the files.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2020-03-05 10:38:41 +01:00
Pino Toscano
b6bead0097 filesystems: fix size reporting for filesystems
The current way to get the size of a filesystem is to query the size in
bytes of the device. However, this gives the whole size of the device
where a filesystem is stored, and it does not consider the actual size
for which the filesystem is configured (e.g. in case it was shrunk).
A simple reproducer for this is:
$ guestfish -N test.img=fs:ext4:2G resize2fs-size /dev/sda1 1073741824

As result, try to mount the filesystem, and get its actual statistics to
determine its full size. In case mounting fails, fall back to the
previous method, which is still a good value in the majority of the
cases.

Thanks to: Erik Skultety.
2020-02-27 10:25:54 +01:00
Richard W.M. Jones
1e180cb9fd Update common submodule to latest. 2020-02-26 09:48:45 +00:00
Nikolay Ivanets
d9b4e3086e virt-make-fs: add '--blocksize' option support
This patch adds '--blocksize' command line option for virt-make-fs
tool.  This option allows specifying disk sector size as described in
'guestfs_add_drive_opts' libguestfs API.
2020-02-24 20:48:33 +00:00
Daniel P. Berrangé
7db041a660 docs: fix instructions for building from git
On current Fedora releases the ocaml modules will fail to
link unless CFLAGS contains -fPIC.

The autogen.sh script only updates the 'gnulib' submodule,
and so the build will fail due to the missing 'common'
submodule. This needs to be manually initialized at checkout.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-02-24 13:25:59 +00:00
Martin Kletzander
c7d7b25524 mlcustomize: Trim whitespaces from commands read from file (RHBZ#1351000)
The first split does not care about the whole string, it is just trying to get
the command name in front, so triml is just right.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2020-02-24 13:14:46 +01:00
Richard W.M. Jones
ab4e4af090 Update common submodule. 2020-02-24 11:12:10 +00:00
Csaba Henk
83474887ed ruby: change value of 'readonly' drive toption to Boolean in doc/example/test
Seeing `g.add_drive_opt :readonly => 1` allows one to imply
that ensuring writable access to drive should happen via
`g.add_drive_opt :readonly => 0`. However, the passed option
value gets passed down to C according to Ruby Boolean semantics,
that is, any value apart from `false` and `nil` will be true
(see RTEST in Ruby C API).

So its more idiomatic and provides a better hint if we use
`g.add_drive_opt :readonly => true` in Ruby samples.
2020-02-19 18:27:02 +00:00
Richard W.M. Jones
b68a67e1a9 Revert "golang: Don't run launch test if appliance has not been built."
This causes a strange error with modern golang:

  go: parsing $GOFLAGS: non-flag "appliance"

This reverts commit d57d8f22de.
2020-02-19 18:24:51 +00:00
Csaba Henk
95244fd2ca golang: make API idiomatic so that functions return (<val>, error)
Go API functions returned (<val>, *GuestfsError) that made
code like this fail to build:

    n, err := os.Stdin.Read(buf)
    if err != nil {
        log.Fatal(err)
    }
    n, err = g.Pwrite_device(dev, buf[:n], off)
    ...

As err should be of error (interface) type as of the stdlib call,
and should be of *GuestfsError type as of the libguestfs call.

The concrete error value that libguestfs functions return can be
a *GuestfsError, but the function signature should have (<val>, error)
as return value.
2020-02-19 18:12:15 +00:00
Nikolay Ivanets
c509420be7 virt-get-kernel: add '--blocksize' option support
This patch adds '--blocksize' command line option for virt-get-kernel
tool.  This option allows specifying disk sector size as described in
'guestfs_add_drive_opts' libguestfs API.
2020-02-17 18:04:11 +00:00
Richard W.M. Jones
e6764a5415 appliance: Add ntfs-3g-system-compression (RHBZ#1703463).
This package in Fedora enables optional support for Windows 10
"CompactOS" (file-level compression), read-only, which is sufficient
for inspecting Windows guests and doing certain types of modifications
to them.  Virt-v2v appears to work, but it may be that anything that
involves modifying a compressed file might not work.

I couldn't find the equivalent package in Debian or SUSE.  It's
available in Arch AUR although I didn't verify that part of the change
actually works there (but should be safe because supermin ignores
packages that are not known about on the target system).
2020-02-17 12:38:27 +00:00
Nikolay Ivanets
6b6bb44ebc tools: add '--blocksize' option for C-based tools
This patch adds '--blocksize' command line option for guestfish and
other C-based tools.  This option allows specifying disk sector size.
2020-02-17 12:32:03 +00:00
Nikolay Ivanets
94843f155a lib: add support for disks with 4096 bytes sector size
Nowadays there are hard drives and operating systems which support
"4K native" sector size.  In this mode physical and logical block size
exposed to the operating system is equal to 4096 bytes.

GPT partition table (as a known example) being created in this mode will
place GPT header at LBA1 which is 4096 bytes.  libguetfs is unable to
recognize partition table on such physical block devices or disk images.
The reason is that libguestfs appliance will look for a GPT header at
LBA1 which is seen at 512 byte offset.

In order to fix the issue we need a way to provide correct logical block
size for attached disks.  Fortunately QEMU and libvirt already provides
a way to specify physical/logical block size per disk basis.

After discussion in a mailing list we agreed that physical block size is
rarely used and is not so important.  Thus both physical and logical
block size will be set to the same value.

In this patch one more optional parameter 'blocksize' is added
to add_drive_opts API method.  Valid values are 512 and 4096.

add_drive_scratch has the same optional parameter for a consistency and
testing purpose.

add-domain and add_libvirt_dom will pass logical_block_size value from
libvirt XML to add_drive_opts method.
2020-02-11 15:20:09 +00:00
Richard W.M. Jones
815eab8a66 tests: Use explicit backing format for all backing disks.
Libvirt 6.0 now requires that every disk in the backing chain has an
explicit backing format.  For example this will be rejected by
libvirt:

  qemu-img create -f qcow2 -b backing-disk disk.qcow2

with the error:

  Original error from libvirt: Requested operation is not valid:
  format of backing image 'backing-disk' of image 'disk.qcow2' was not
  specified in the image metadata (See
  https://libvirt.org/kbase/backing_chains.html for troubleshooting)
  [code=55 int1=-1]

Instead you have to use the -F option to specify the format, eg:

  qemu-img create -f qcow2 -b backing-disk -F raw disk.qcow2
2020-02-06 16:06:19 +00:00
Daria Phoebe Brashear
56834875b2 properly initialize error_data_lock_list before use
when a handle is allocated, the error_data_list_lock must be initialized
2020-02-06 13:23:31 +00:00
Richard W.M. Jones
d6fcf519f2 builder: Fix const correctness for OCaml 4.10.
String_val now returns a const char *.
2020-02-06 10:33:39 +00:00
Richard W.M. Jones
9f3148c791 ocaml: Use caml_alloc_initialized_string instead of memcpy.
See this commit in libguestfs-common:
398dc56a6c
2020-02-06 10:32:08 +00:00
Richard W.M. Jones
378b49152d m4: ocaml: Move definition of HIVEX_OPEN_UNSAFE_FLAG closer to test.
Minor code cleanup, no change in semantics.
2020-02-06 10:28:34 +00:00
Richard W.M. Jones
4e199494c4 cat: Fix GCC 10 warning.
I believe this warning is bogus, but simply initializing the local
variable is enough to avoid it.

log.c: In function 'do_log':
log.c:390:7: error: 'comm_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  390 |       printf (" %.*s", (int) comm_len, comm);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-02-06 10:28:34 +00:00
Pino Toscano
b3ef101a0f daemon: fix/enhance error reporting of Augeas exceptions
The current code was broken, as the field 1 of the exception value is
the error code (int), not an error string, and thus it would have
crashed.  This did not happen in practice, as all the usage of
ocaml-augeas were only in the inspection code with ad-hoc exception
catching blocks.

Other than fixing the aforementioned issue, enhance the error reporting
to be as close as possible to what the current AUGEAS_ERROR() macro
does: error message, error minor message (if available), error details
(if available).
2020-01-27 14:53:35 +01:00
Richard W.M. Jones
a883a2f0c9 Update BUGS and PO files. 2020-01-22 13:07:08 +00:00
Richard W.M. Jones
d4a1c3a778 build: Add build-aux/config.rpath from gettext.
This is somehow required after updating gnulib.  I lack the energy to
find out exactly why, but this fixes it.
2020-01-22 13:07:01 +00:00
Richard W.M. Jones
538f728d5f Update gnulib. 2020-01-22 13:03:03 +00:00
Richard W.M. Jones
f7bb3eef19 Update common submodule. 2020-01-22 13:03:03 +00:00
Richard W.M. Jones
bd4d9264e5 docs: Update release notes in preparation for 1.42 release. 2020-01-22 13:03:03 +00:00
Richard W.M. Jones
54ccd4fee9 docs: Document that Python 2.7 or above is now required.
Updates commit 444750bfd1.
2020-01-22 10:45:37 +00:00
Pino Toscano
a754cd4307 launch: libvirt: use machine type when querying for domcaps
On some architectures a certain machine type is used, so use it when
querying the libvirt domain capabilities.
2020-01-20 13:00:12 +01:00
Pino Toscano
e636e64d34 lib: uefi: use the efi libvirt firmware if available
In case libvirt supports the firmware autoselection and there is an EFI
firmware available, use it directly instead of handling the firmware
manually.
2020-01-20 13:00:12 +01:00
Pino Toscano
029901113c lib: allow to use libvirt firmware autoselection
Enhance the UEFI firmware lookup function with the information on the
libvirt firmware autoselection, allowing it to return a value to use for
the appliance.

At the moment no firmware is selected this way, so there is no behaviour
change.
2020-01-20 13:00:06 +01:00