zfs-fuse has been unmaintained for a very long time. In fact, the
website has gone. This means that whatever we need for zfs (probably
some kind of license-compatible kernel module) is not going to be
provided by zfs-fuse.
See: https://bugzilla.redhat.com/show_bug.cgi?id=2214965
A customer case was found where /etc/fstab contained multiple root
mountpoints, something like:
LABEL=System / xfs ...
LABEL=Boot /boot ext2 ...
LABEL=System / xfs ...
This causes libguestfs and virt-v2v to fail. Either (on RHEL 9) we
try to mount the second instance of / which gives an error. Or (on
upstream kernels) we are able to mount the second instance but then
libguestfs gets confused when trying to unmount them.
In this case as the mounted devices are the same we can just delete
the duplicate. It's also possible that there could be multiple
non-identical root mountpoints, in which case we have to pick one, and
this code arbitrarily picks the first[*] (but emits a warning).
We don't do anything for non-root mountpoints.
Update common submodule to add 'List.same' function from mlstdutils.
[*] Which one is "the first" depends on what version of ocaml-augeas
we are using. ocaml-augeas version 0.6 Augeas.matches function
returns entries in reverse order (compared to augeas itself). This is
fixed in version 0.7:
http://git.annexia.org/?p=ocaml-augeas.git;a=commitdiff;h=b703b92e3d26690aa6f7b822132049ce5435983e
Fixes: https://issues.redhat.com/browse/RHEL-90168
We could match on 1- and 2-digit RHEL issues, thus matching strings
like "RHEL-9" and "RHEL-10". No such Jira issues exist for us.
(cherry picked from commit 846ecb2b3840212c6f2cad6a15a6b33cd2e912bf)
We didn't correctly check for an error from the ioctl. Thus when
using a raw block device you would often see a bogus warning in
debugging output.
Related: https://issues.redhat.com/browse/MTV-2441
Commit e11583a03a ("ocaml: Don't embed -L../lib/.libs in final
mlguestfs.cma or .cmxa") was correct in itself, but as a side effect
caused mlguestfs.cma to be linked to the system libguestfs. If system
libguestfs was not installed, the build would fail entirely with:
ocamlmklib -o mlguestfs \
-ldopt '-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' \
libguestfsocaml_a-guestfs-c.o libguestfsocaml_a-guestfs-c-actions.o libguestfsocaml_a-guestfs-c-errnos.o ../common/utils/libguestfsocaml_a-cleanups.o ../common/utils/libguestfsocaml_a-stringlists-utils.o guestfs.cmo \
\
-lguestfs
/usr/bin/ld: cannot find -lguestfs: No such file or directory
Fix (from Mohamed Akram) is to add -L../lib/.libs to the -ldopt flag.
This does not embed the option in the final mlguestfs.cma file, but
seems to only use it while building the library.
Updates: commit e11583a03a
Reported-by: Mohamed Akram
Fixes: https://github.com/libguestfs/libguestfs/issues/191
$ ocamlobjinfo /usr/lib64/ocaml/guestfs/mlguestfs.cma
File /usr/lib64/ocaml/guestfs/mlguestfs.cma
Force custom: no
Extra C object files: -lmlguestfs -L../lib/.libs -lguestfs
...
(and the same in mlguestfs.cmxa). This was caused because we run
ocamlmklib with this -L parameter so that OCaml tests and examples
will link with the local libguestfs.so (instead of the
system-installed version), but for other reasons that doesn't actually
work either.
Comment from Eric Blake:
> We don't have any hard-links in our source. GNU cp -d is the same as
> cp -P --preserve=links, but --preserve=links only matters for hard
> links, so losing it doesn't hurt our usage. I'm inclined to just go
> with cp -P unconditionally rather than needing the configure.ac
> logic for $(CP_D).
Fixes: https://github.com/libguestfs/libguestfs/issues/183
Reported-by: Mohamed Akram
Thanks: Eric Blake
These libraries are only needed if building the daemon (so not if
using ./configure --disable-daemon). Move the tests so we only check
for these libraries if the daemon is enabled in the build.
The daemon also requires ocaml-augeas (it uses both the augeas C
library directly and the OCaml bindings for augeas, for reasons).
However that test is already disabled if the daemon is not being
built.
Reported-by: Mohamed Akram
Fixes: commit dfa9dee775
Fixes: commit 8a723ca62e
Fixes: commit 228d49bb84
Fixes: https://github.com/libguestfs/libguestfs/issues/184
libmagic (part of the "file" command) was required in earlier versions
of libguestfs, but this requirement was effectively removed in
commit b48da89dd6 ("daemon: Reimplement ‘file_architecture’ API in
OCaml") back in 2017. Or to be more precise, we now use the "file"
command inside the daemon, which may or may not use libmagic but we
no longer link to the library directly.
Reported-by: Mohamed Akram
Fixes: commit b48da89dd6
Related: https://github.com/libguestfs/libguestfs/issues/184
Linux + LVM supports device names like /dev/disk/by-id/dm-uuid-LVM-
followed by two concatenated UUIDs, firstly for the volume group and
secondly for the logical volume. We can reverse those to get the
device name (/dev/VG/LV).
fstab entries look like:
# / was on /dev/vg0/lv-0 during curtin installation
/dev/disk/by-id/dm-uuid-LVM-OzFWT6NHkstr1hcmrWRRMDGPn9xdZj1YOOycQ533186x288FdU6UubU3OlnWJz6D / ext4 defaults 0 1
# /usr was on /dev/vg0/lv-1 during curtin installation
/dev/disk/by-id/dm-uuid-LVM-OzFWT6NHkstr1hcmrWRRMDGPn9xdZj1YZu53m4ZssZ8Jeb3I14RAJwIj5YlHIb9P /usr ext4 defaults 0 1
The upshot of this fix is that we are now able to correctly inspect
and run virt-v2v on Ubuntu 22+ guests with split /usr. In particular,
we correctly map /etc/fstab entries like the above to LV device names,
which means that /usr merging now works correctly.
Reported-by: Jaroslav Spanko
Thanks: Daniel Berrange
Fixes: https://issues.redhat.com/browse/RHEL-87493
These were previously written in very convoluted C which had to deal
with parsing the crazy output of the "lvm" command. In fact the
parsing was so complex that it was generated by the generator. It's
easier to do this in OCaml.
These are basically legacy APIs. They cannot be expanded and LVM
already supports many more fields. We should replace these with APIs
for getting single named fields from LVM.
This was implemented wrongly. In the XDR protocol, UUIDs are fixed
buffers of length 32. We can just use memcpy to copy from the OCaml
string to the UUID, but we have to ensure the string length returned
by OCaml is correct (if not we just assert, it's an internal error).
(It didn't even compile before, so we know it was never used).
Ubuntu 22= uses /dev/disk/by-uuid/ followed by a filesystem UUID in
fstab entries. Resolve these to mountables.
A typical fstab entry looks like this:
# /boot was on /dev/vda2 during curtin installation
/dev/disk/by-uuid/b4e56462-5a64-4272-b76d-f5e58bd8f128 /boot ext4 defaults 0 1
The comment is generated by the installer and appears in the fstab.
This entry would be translated to /dev/sda2.
This acts just like FString except that we do reverse device name
translation on it. The only use is in the 'pvs-full' API where we
will use it (in a subsequent commit) to reverse translate the pv_name
field (a device name) before returning it from the daemon.
Compare this to the 'pvs' API which also returns a list of device
names, but using the generator's 'RStructList (RDevice,...)' return
type, where RDevice is similarly reverse translated.
Note in the library-side bindings, because the name has already been
translated in the daemon, we just treat it exactly the same as
FString. The vast majority of this patch is this mechanical change.
Cole Robinson (2):
mltools: decouple and simplify osinfo device support checks
mlcustomize: disable `--inject-virtio-win osinfo`
Richard W.M. Jones (3):
mltools: Fix de-oUnit-ized tests
mltools: Unreference various objects
Revert "mltools: Unreference various objects"
And update customize docs to match
Signed-off-by: Cole Robinson <crobinso@redhat.com>
These are not required by libguestfs. They were used by virt-builder,
but that tool has now been moved to a separate project
(guestfs-tools).
Fixes: commit 733d2182b6