Commit Graph

12342 Commits

Author SHA1 Message Date
Richard W.M. Jones
f6b1a7b57f appliance: Remove zfs-fuse
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
2025-05-09 15:52:30 +01:00
Richard W.M. Jones
61d7d16981 Version 1.55.11. v1.55.11 2025-05-09 15:43:11 +01:00
Richard W.M. Jones
5441d3dd0c daemon: inspect: Remove duplicate root mountpoints in /etc/fstab
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
2025-05-08 21:14:23 +01:00
Richard W.M. Jones
8836c3d075 docs: Add outline release notes for libguestfs 1.56 2025-05-06 18:16:33 +01:00
Richard W.M. Jones
2424976a3c bugs-in-changelog.sh: Match at least 3 digits after RHEL- for Jira issue
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)
2025-05-06 17:40:06 +01:00
Richard W.M. Jones
59bad26898 lib/create.c: Fix check after BLKDISCARD
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
2025-05-01 09:10:52 +01:00
Richard W.M. Jones
9b32056061 Fix miscellaneous spelling mistakes
$ git ls-files | xargs codespell
2025-04-29 19:05:07 +01:00
Richard W.M. Jones
ca87485eea daemon/fstrim.c: Run the fstrim command twice
In upstream kernels, for XFS, you may have to run fstrim twice for it
to be effective.

Fixes: https://issues.redhat.com/browse/RHEL-88508
Related: https://issues.redhat.com/browse/RHEL-88450
Thanks: Eric Sandeen
2025-04-28 10:07:34 +01:00
Richard W.M. Jones
7022b2a492 Version 1.55.10. v1.55.10 2025-04-26 11:27:19 +01:00
Richard W.M. Jones
a5fa81db03 ocaml: Link mlguestfs.cma and .cmxa with local libguestfs
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
2025-04-26 09:56:56 +01:00
Richard W.M. Jones
137fde9f77 ocaml: Prefer -ccopt -L... instead of -cclib
Reported-by: Mohamed Akram
Fixes: https://github.com/libguestfs/libguestfs/issues/191
2025-04-26 09:41:08 +01:00
Richard W.M. Jones
e11583a03a ocaml: Don't embed -L../lib/.libs in final mlguestfs.cma or .cmxa
$ 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.
2025-04-26 09:41:08 +01:00
Richard W.M. Jones
e127edcafc daemon/fstrim.c: Issue sync_disks after fstrim
Thanks: Eric Sandeen
2025-04-25 15:24:43 +01:00
Richard W.M. Jones
4d5fe341c7 ocaml-link.sh.in: Remove redundant use of getopt
Also allow --cclib as an alternative, and improved error reporting
when parsing the parameters to the script.

Fixes: https://github.com/libguestfs/guestfs-tools/issues/16
Reported-by: Mohamed Akram
2025-04-23 22:39:44 +01:00
Richard W.M. Jones
e49d65a5fd bash: Replace 'cp -d' command with POSIX 'cp -P'
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
2025-04-22 18:41:51 +01:00
Richard W.M. Jones
166395914f daemon: Use $(OCAMLLIB) instead of ocamlc -where
OCAMLLIB is already set to the value of ocamlc -where that was found
at configure time, so there is no need to run that command again at
build time.
2025-04-22 12:37:40 +01:00
Richard W.M. Jones
0423f2cec3 build: Only require augeas and hivex if also building the daemon
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
2025-04-22 12:31:15 +01:00
Richard W.M. Jones
2b2be31af0 build: Remove test for libmagic
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
2025-04-22 12:14:04 +01:00
Richard W.M. Jones
632937d8fb m4: Stop autoconf whinging about AC_PROG_CC_STDC being obsolete
I tried using 'autoupdate' but it failed completely to do the right
thing.
2025-04-22 11:47:58 +01:00
Richard W.M. Jones
6bf8c05961 libtool-kill-dependency_libs.sh: Ensure this only runs on *.la files
Fixes: https://github.com/libguestfs/libguestfs/issues/182
Reported-by: Mohamed Akram
2025-04-22 11:18:40 +01:00
Richard W.M. Jones
84d86f42d9 Version 1.55.9. v1.55.9 2025-04-16 21:48:29 +01:00
Richard W.M. Jones
e43ca19129 daemon: inspect: Resolve Ubuntu 22+ /dev/disk/by-id/dm-uuid-LVM-... in fstab
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
2025-04-16 21:12:49 +01:00
Richard W.M. Jones
a73f248369 daemon: Rewrite {pvs,vgs,lvs}-full APIs in OCaml
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.
2025-04-16 21:12:49 +01:00
Richard W.M. Jones
3f9078261c Update common submodule
Pulls in these commits:

  Richard W.M. Jones (2):
      mltools: Fix memory leak in OCaml binding of libosinfo
      mlstdutils: Implement String.implode
2025-04-16 21:12:49 +01:00
Richard W.M. Jones
bcd6b3ec3a generator: Fix implementation of FUUID for OCaml functions
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).
2025-04-16 21:12:49 +01:00
Richard W.M. Jones
7a1ffd744b daemon: inspect: Resolve Ubuntu 22+ /dev/disk/by-uuid/ in fstab
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.
2025-04-16 21:12:49 +01:00
rwmjones
6fb268997e Merge pull request #186 from rwmjones/2025-fdevice
Implement struct FDevice type in the generator and use it for `pvs_full`
2025-04-16 21:11:57 +01:00
Richard W.M. Jones
5a16d1120f generator: Use new FDevice type for the pvs-full pv_name field
Remove the code which did explicit reverse device name translation,
and use the generator's code instead.
2025-04-16 12:27:07 +01:00
Richard W.M. Jones
0ff73a42c7 generator: Implement struct FDevice type
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.
2025-04-16 12:27:07 +01:00
Richard W.M. Jones
2d1e894130 daemon: inspect: Add some debugging of /usr merging 2025-04-16 10:28:41 +01:00
rwmjones
7d561ee6f0 Merge pull request #178 from crobinso/osinfo-doc-tweak
common: update submodule
2025-04-09 21:33:28 +01:00
Cole Robinson
abdec091c4 common: update submodule
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>
2025-04-09 16:12:44 -04:00
rwmjones
945d4e0663 Merge pull request #177 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-04-04 11:10:10 +01:00
Weblate
8cad86d63c Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2025-04-04 12:06:26 +02:00
Ricky Tigg
1b27b7ed1a Translated using Weblate (Finnish)
Currently translated at 9.7% (94 of 960 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/fi/
2025-04-04 12:06:26 +02:00
Richard W.M. Jones
8f375320c3 Version 1.55.8. v1.55.8 2025-04-03 19:31:16 +01:00
Richard W.M. Jones
f523684a0b lib/launch-libvirt.c: Remove fallback <emulator> for Arm
This "hopefully temporary hack" was actually added 12 years ago in
commit 37e1e0da5a ("arm: launch: libvirt: Force <emulator>.")
2025-03-31 18:19:00 +01:00
rwmjones
3951893849 Merge pull request #176 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-03-31 15:16:09 +01:00
Ettore Atalan
4a8acbf87d Translated using Weblate (German)
Currently translated at 33.8% (325 of 960 strings)

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/de/
2025-03-31 13:53:35 +02:00
Richard W.M. Jones
85c8445e1e build: Remove use of oUnit
This added no value over just running ordinary tests.  This also
removes a complicated OCaml dependency.
2025-03-22 12:41:39 +00:00
rwmjones
2f0fa0fd23 Merge pull request #175 from weblate/weblate-libguestfs-libguestfs-master
Translations update from Fedora Weblate
2025-03-22 11:47:37 +00:00
Weblate
693465e057 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libguestfs/libguestfs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-master/
2025-03-22 11:53:58 +01:00
Ricky Tigg
4d6387da3f Translated using Weblate (Finnish)
Currently translated at 1.1% (152 of 13341 strings)

Translation: libguestfs/libguestfs-docs-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/libguestfs-docs-master/fi/
2025-03-22 11:53:58 +01:00
Richard W.M. Jones
090ea7656e build: Remove detection of lex and yacc
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
2025-03-22 10:51:21 +00:00
Richard W.M. Jones
f7083e588e build: Add heading about basic build environment
(cherry picked from
virt-v2v commit c523c63a4916b5620666341dad54bf5d999c1fbe)
2025-03-16 13:58:56 +00:00
Richard W.M. Jones
21ae4c37b7 build: Only use ANSI colour sequences if stdout is a terminal
https://stackoverflow.com/a/10022396
2025-03-11 21:04:20 +00:00
Richard W.M. Jones
3a8947323b build: Colourize features
Print yes features in green and no features in red.
2025-03-11 15:31:17 +00:00
Richard W.M. Jones
cf75c12a9e build: Embolden headings in configure output
If using a colour terminal, display headings in bold.
2025-03-11 15:30:18 +00:00
Richard W.M. Jones
471d328b9e build: Add 'feature' and 'print' to display configured features.
Borrow 'feature' and 'print' functions from nbdkit and use these to
display configured features in a simpler and more consistent way.
2025-03-11 15:28:50 +00:00
Richard W.M. Jones
e765e31f3a Version 1.55.7. v1.55.7 2025-03-11 14:44:16 +00:00