diff --git a/SOURCES/0001-RHEL-8-Remove-libguestfs-live-RHBZ-798980.patch b/SOURCES/0001-RHEL-8-Remove-libguestfs-live-RHBZ-798980.patch index 8b6492c..19dfe77 100644 --- a/SOURCES/0001-RHEL-8-Remove-libguestfs-live-RHBZ-798980.patch +++ b/SOURCES/0001-RHEL-8-Remove-libguestfs-live-RHBZ-798980.patch @@ -52,5 +52,5 @@ index 921e6d1df..8b2887247 100644 TESTS_ENVIRONMENT = $(top_builddir)/run --test -- -2.18.4 +2.31.1 diff --git a/SOURCES/0002-RHEL-8-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch b/SOURCES/0002-RHEL-8-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch index 6bca5ad..4e2ee11 100644 --- a/SOURCES/0002-RHEL-8-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch +++ b/SOURCES/0002-RHEL-8-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch @@ -326,5 +326,5 @@ index 69ea7134a..0782e8ceb 100644 gobject/src/optargs-ntfsclone_out.c gobject/src/optargs-ntfsfix.c -- -2.18.4 +2.31.1 diff --git a/SOURCES/0003-RHEL-8-Disable-unsupported-remote-drive-protocols-RH.patch b/SOURCES/0003-RHEL-8-Disable-unsupported-remote-drive-protocols-RH.patch index 2697695..91159d2 100644 --- a/SOURCES/0003-RHEL-8-Disable-unsupported-remote-drive-protocols-RH.patch +++ b/SOURCES/0003-RHEL-8-Disable-unsupported-remote-drive-protocols-RH.patch @@ -605,5 +605,5 @@ index 19dd60a2f..583e031bd 100755 -grep -sq -- '-drive file=ssh://rich@example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail -rm "$DEBUG_QEMU_FILE" -- -2.18.4 +2.31.1 diff --git a/SOURCES/0004-RHEL-8-Remove-User-Mode-Linux-RHBZ-1144197.patch b/SOURCES/0004-RHEL-8-Remove-User-Mode-Linux-RHBZ-1144197.patch index e2fcf76..bb2f9e9 100644 --- a/SOURCES/0004-RHEL-8-Remove-User-Mode-Linux-RHBZ-1144197.patch +++ b/SOURCES/0004-RHEL-8-Remove-User-Mode-Linux-RHBZ-1144197.patch @@ -68,5 +68,5 @@ index 5aec50a57..8b9fcd770 100644 static int shutdown_uml (guestfs_h *g, void *datav, int check_for_errors) -- -2.18.4 +2.31.1 diff --git a/SOURCES/0005-RHEL-8-Reject-use-of-libguestfs-winsupport-features-.patch b/SOURCES/0005-RHEL-8-Reject-use-of-libguestfs-winsupport-features-.patch index af9f717..ecdd554 100644 --- a/SOURCES/0005-RHEL-8-Reject-use-of-libguestfs-winsupport-features-.patch +++ b/SOURCES/0005-RHEL-8-Reject-use-of-libguestfs-winsupport-features-.patch @@ -65,5 +65,5 @@ index 39ccc2068..2b2e2d8a9 100644 exit (EXIT_FAILURE); -- -2.18.4 +2.31.1 diff --git a/SOURCES/0006-build-Avoid-warnings-about-unknown-pragmas.patch b/SOURCES/0006-build-Avoid-warnings-about-unknown-pragmas.patch index c6c117e..b322d8d 100644 --- a/SOURCES/0006-build-Avoid-warnings-about-unknown-pragmas.patch +++ b/SOURCES/0006-build-Avoid-warnings-about-unknown-pragmas.patch @@ -33,5 +33,5 @@ index 25ffea0d9..bbb4db464 100644 NO_SNV_CFLAGS= -- -2.18.4 +2.31.1 diff --git a/SOURCES/0007-daemon-lvm-Use-lvcreate-yes-to-avoid-interactive-pro.patch b/SOURCES/0007-daemon-lvm-Use-lvcreate-yes-to-avoid-interactive-pro.patch index 8f447e0..54275ce 100644 --- a/SOURCES/0007-daemon-lvm-Use-lvcreate-yes-to-avoid-interactive-pro.patch +++ b/SOURCES/0007-daemon-lvm-Use-lvcreate-yes-to-avoid-interactive-pro.patch @@ -90,5 +90,5 @@ index 000000000..27089beaa + +rm $f -- -2.18.4 +2.31.1 diff --git a/SOURCES/0008-inspection-More-reliable-detection-of-Linux-split-us.patch b/SOURCES/0008-inspection-More-reliable-detection-of-Linux-split-us.patch index 0d9aed5..5b14b93 100644 --- a/SOURCES/0008-inspection-More-reliable-detection-of-Linux-split-us.patch +++ b/SOURCES/0008-inspection-More-reliable-detection-of-Linux-split-us.patch @@ -109,5 +109,5 @@ index 6e00c7083..02b5a0470 100644 debug_matching "Linux /usr"; role := `Usr; -- -2.18.4 +2.31.1 diff --git a/SOURCES/0009-lib-Autodetect-backing-format-for-qemu-img-create-b.patch b/SOURCES/0009-lib-Autodetect-backing-format-for-qemu-img-create-b.patch index 240df78..6cc2f94 100644 --- a/SOURCES/0009-lib-Autodetect-backing-format-for-qemu-img-create-b.patch +++ b/SOURCES/0009-lib-Autodetect-backing-format-for-qemu-img-create-b.patch @@ -45,5 +45,5 @@ index 44a7df25f..75a4d3a28 100644 if (STREQ (optargs->preallocation, "off") || STREQ (optargs->preallocation, "sparse")) -- -2.18.4 +2.31.1 diff --git a/SOURCES/0010-daemon-chroot-Fix-long-standing-possible-deadlock.patch b/SOURCES/0010-daemon-chroot-Fix-long-standing-possible-deadlock.patch index 08c4608..d606eae 100644 --- a/SOURCES/0010-daemon-chroot-Fix-long-standing-possible-deadlock.patch +++ b/SOURCES/0010-daemon-chroot-Fix-long-standing-possible-deadlock.patch @@ -40,5 +40,5 @@ index 5e856c91f..7da8ae29e 100644 | Either ret -> ret | Or exn -> raise exn -- -2.18.4 +2.31.1 diff --git a/SOURCES/0011-inspection-Fix-inspection-of-recent-RPM-guests-using.patch b/SOURCES/0011-inspection-Fix-inspection-of-recent-RPM-guests-using.patch index 48b5839..49f0938 100644 --- a/SOURCES/0011-inspection-Fix-inspection-of-recent-RPM-guests-using.patch +++ b/SOURCES/0011-inspection-Fix-inspection-of-recent-RPM-guests-using.patch @@ -1060,5 +1060,5 @@ index bf1f83c9d..f90bda04e 100644 AC_PATH_PROGS([PBMTEXT],[pbmtext],[no]) AC_PATH_PROGS([PNMTOPNG],[pnmtopng],[no]) -- -2.18.4 +2.31.1 diff --git a/SOURCES/0012-inspection-Return-RPM-epoch.patch b/SOURCES/0012-inspection-Return-RPM-epoch.patch index 069230f..9e50561 100644 --- a/SOURCES/0012-inspection-Return-RPM-epoch.patch +++ b/SOURCES/0012-inspection-Return-RPM-epoch.patch @@ -32,5 +32,5 @@ index 92a3abf58..be0e81e22 100644 /* Convert this to an OCaml struct. Any NULL fields must be turned -- -2.18.4 +2.31.1 diff --git a/SOURCES/0013-test-data-phony-guests-Fix-phony-RPM-database-fix-vi.patch b/SOURCES/0013-test-data-phony-guests-Fix-phony-RPM-database-fix-vi.patch index 4c6e828..91fa8ef 100644 --- a/SOURCES/0013-test-data-phony-guests-Fix-phony-RPM-database-fix-vi.patch +++ b/SOURCES/0013-test-data-phony-guests-Fix-phony-RPM-database-fix-vi.patch @@ -4660,5 +4660,5 @@ index 28b9c1db0..90492b814 100755 $g->upload ($ENV{SRCDIR}.'/../binaries/bin-x86_64-dynamic', '/bin/ls'); -- -2.18.4 +2.31.1 diff --git a/SOURCES/0014-po-POTFILES-Fix-list-of-files-for-translation.patch b/SOURCES/0014-po-POTFILES-Fix-list-of-files-for-translation.patch index 95a37f6..2cc1fd6 100644 --- a/SOURCES/0014-po-POTFILES-Fix-list-of-files-for-translation.patch +++ b/SOURCES/0014-po-POTFILES-Fix-list-of-files-for-translation.patch @@ -30,5 +30,5 @@ index 0782e8ceb..fdc6e8062 100644 lib/errors.c lib/event-string.c -- -2.18.4 +2.31.1 diff --git a/SOURCES/0015-m4-guestfs-find-db-tool.m4-Remove-unused-file.patch b/SOURCES/0015-m4-guestfs-find-db-tool.m4-Remove-unused-file.patch index 11593fb..e8c3050 100644 --- a/SOURCES/0015-m4-guestfs-find-db-tool.m4-Remove-unused-file.patch +++ b/SOURCES/0015-m4-guestfs-find-db-tool.m4-Remove-unused-file.patch @@ -60,5 +60,5 @@ index b404148c6..000000000 - popdef([VARIABLE]) -]) -- -2.18.4 +2.31.1 diff --git a/SOURCES/0016-test-data-phony-guests-Fix-phony-RPM-database-fix-vi.patch b/SOURCES/0016-test-data-phony-guests-Fix-phony-RPM-database-fix-vi.patch index b9ed6e6..ca169bd 100644 --- a/SOURCES/0016-test-data-phony-guests-Fix-phony-RPM-database-fix-vi.patch +++ b/SOURCES/0016-test-data-phony-guests-Fix-phony-RPM-database-fix-vi.patch @@ -470,5 +470,5 @@ index df6060a73..72cddaf88 100644 -- -2.18.4 +2.31.1 diff --git a/SOURCES/0017-launch-libvirt-place-our-virtio-net-pci-device-in-sl.patch b/SOURCES/0017-launch-libvirt-place-our-virtio-net-pci-device-in-sl.patch new file mode 100644 index 0000000..ccedd9b --- /dev/null +++ b/SOURCES/0017-launch-libvirt-place-our-virtio-net-pci-device-in-sl.patch @@ -0,0 +1,65 @@ +From 6657d0c1018ab44ae680376463ac3f0421548fb4 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 23 Dec 2021 11:36:59 +0100 +Subject: [PATCH] launch-libvirt: place our virtio-net-pci device in slot 0x1e + +The trick we use for adding our virtio-net-pci device +in the libvirt backend can conflict with libvirtd's and QEMU's PCI address +assignment. Try to mitigate that by placing our device in slot 0x1e on the +root bus. In practice this could only conflict with a "dmi-to-pci-bridge" +device model, which libvirtd itself places in slot 0x1e. However, given +the XMLs we generate, and modern QEMU versions, libvirtd has no reason to +auto-add "dmi-to-pci-bridge". Refer to +. + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160 +Signed-off-by: Laszlo Ersek +Message-Id: <20211223103701.12702-2-lersek@redhat.com> +Reviewed-by: Richard W.M. Jones +Tested-by: Richard W.M. Jones +(cherry picked from commit 5ce5ef6a97a58c5e906083ad4e944545712b3f3f) +--- + lib/guestfs-internal.h | 11 +++++++++++ + lib/launch-libvirt.c | 4 +++- + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h +index 4799ee0a1..0b46f0070 100644 +--- a/lib/guestfs-internal.h ++++ b/lib/guestfs-internal.h +@@ -147,6 +147,17 @@ + #define VIRTIO_DEVICE_NAME(type) type "-pci" + #endif + ++/* Place the virtio-net controller in slot 0x1e on the root bus, on normal ++ * hardware with PCI. Refer to RHBZ#2034160. ++ */ ++#ifdef HAVE_LIBVIRT_BACKEND ++#if defined(__arm__) || defined(__s390x__) ++#define VIRTIO_NET_PCI_ADDR "" ++#else ++#define VIRTIO_NET_PCI_ADDR ",addr=1e.0" ++#endif ++#endif ++ + /* Guestfs handle and associated structures. */ + + /* State. */ +diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c +index 026dc6b26..5842319df 100644 +--- a/lib/launch-libvirt.c ++++ b/lib/launch-libvirt.c +@@ -1834,7 +1834,9 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g, + } end_element (); + + start_element ("qemu:arg") { +- attribute ("value", VIRTIO_DEVICE_NAME ("virtio-net") ",netdev=usernet"); ++ attribute ("value", (VIRTIO_DEVICE_NAME ("virtio-net") ++ ",netdev=usernet" ++ VIRTIO_NET_PCI_ADDR)); + } end_element (); + } + +-- +2.31.1 + diff --git a/SOURCES/0018-lib-extract-NETWORK_ADDRESS-and-NETWORK_PREFIX-as-ma.patch b/SOURCES/0018-lib-extract-NETWORK_ADDRESS-and-NETWORK_PREFIX-as-ma.patch new file mode 100644 index 0000000..389df1d --- /dev/null +++ b/SOURCES/0018-lib-extract-NETWORK_ADDRESS-and-NETWORK_PREFIX-as-ma.patch @@ -0,0 +1,70 @@ +From 4b9eac11db3e2cc9ace397ed4c804356a7d9adbf Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 23 Dec 2021 11:37:00 +0100 +Subject: [PATCH] lib: extract NETWORK_ADDRESS and NETWORK_PREFIX as macros + +The 169.254.0.0/16 network specification (for the appliance) is currently +duplicated between the direct backend and the libvirt backend. In a +subsequent patch, we're going to need the network specification in yet +another spot; extract it now to the NETWORK_ADDRESS and NETWORK_PREFIX +macros (simply as strings). + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160 +Signed-off-by: Laszlo Ersek +Message-Id: <20211223103701.12702-3-lersek@redhat.com> +Reviewed-by: Richard W.M. Jones +Tested-by: Richard W.M. Jones +(cherry picked from commit 216de164e091a5c36403f24901698044a43ae0d9) +--- + lib/guestfs-internal.h | 6 ++++++ + lib/launch-direct.c | 2 +- + lib/launch-libvirt.c | 3 ++- + 3 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h +index 0b46f0070..97a13ff2c 100644 +--- a/lib/guestfs-internal.h ++++ b/lib/guestfs-internal.h +@@ -158,6 +158,12 @@ + #endif + #endif + ++/* Network address and network mask (expressed as address prefix) that the ++ * appliance will see (if networking is enabled). ++ */ ++#define NETWORK_ADDRESS "169.254.0.0" ++#define NETWORK_PREFIX "16" ++ + /* Guestfs handle and associated structures. */ + + /* State. */ +diff --git a/lib/launch-direct.c b/lib/launch-direct.c +index b6ed9766f..de17d2167 100644 +--- a/lib/launch-direct.c ++++ b/lib/launch-direct.c +@@ -681,7 +681,7 @@ launch_direct (guestfs_h *g, void *datav, const char *arg) + start_list ("-netdev") { + append_list ("user"); + append_list ("id=usernet"); +- append_list ("net=169.254.0.0/16"); ++ append_list ("net=" NETWORK_ADDRESS "/" NETWORK_PREFIX); + } end_list (); + start_list ("-device") { + append_list (VIRTIO_DEVICE_NAME ("virtio-net")); +diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c +index 5842319df..0f38f0aec 100644 +--- a/lib/launch-libvirt.c ++++ b/lib/launch-libvirt.c +@@ -1826,7 +1826,8 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g, + } end_element (); + + start_element ("qemu:arg") { +- attribute ("value", "user,id=usernet,net=169.254.0.0/16"); ++ attribute ("value", ++ "user,id=usernet,net=" NETWORK_ADDRESS "/" NETWORK_PREFIX); + } end_element (); + + start_element ("qemu:arg") { +-- +2.31.1 + diff --git a/SOURCES/0019-launch-libvirt-add-virtio-net-via-the-standard-inter.patch b/SOURCES/0019-launch-libvirt-add-virtio-net-via-the-standard-inter.patch new file mode 100644 index 0000000..fd48ba9 --- /dev/null +++ b/SOURCES/0019-launch-libvirt-add-virtio-net-via-the-standard-inter.patch @@ -0,0 +1,91 @@ +From 8570de6e766297e4c9feab1c54ae05037f33edeb Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 23 Dec 2021 11:37:01 +0100 +Subject: [PATCH] launch-libvirt: add virtio-net via the standard + element + +Starting with version 3.8.0, libvirt allows us to specify the network +address and network mask (as prefix) for SLIRP directly via the + element in the domain XML: +. This means +we don't need the hack for virtio-net on such versions. + +Restrict the hack in construct_libvirt_xml_qemu_cmdline() to +libvirt<3.8.0, and generate the proper element in +construct_libvirt_xml_devices() on libvirt>=3.8.0. + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160 +Suggested-by: Richard W.M. Jones +Signed-off-by: Laszlo Ersek +Message-Id: <20211223103701.12702-4-lersek@redhat.com> +Reviewed-by: Richard W.M. Jones +Tested-by: Richard W.M. Jones +(cherry picked from commit 5858c2cf6c24b3776e3867eafd9d86a1f4912d9c) +--- + lib/guestfs-internal.h | 3 ++- + lib/launch-libvirt.c | 27 +++++++++++++++++++++++++-- + 2 files changed, 27 insertions(+), 3 deletions(-) + +diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h +index 97a13ff2c..b11c945e9 100644 +--- a/lib/guestfs-internal.h ++++ b/lib/guestfs-internal.h +@@ -148,7 +148,8 @@ + #endif + + /* Place the virtio-net controller in slot 0x1e on the root bus, on normal +- * hardware with PCI. Refer to RHBZ#2034160. ++ * hardware with PCI. Necessary only before libvirt 3.8.0. Refer to ++ * RHBZ#2034160. + */ + #ifdef HAVE_LIBVIRT_BACKEND + #if defined(__arm__) || defined(__s390x__) +diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c +index 0f38f0aec..f6bb39d99 100644 +--- a/lib/launch-libvirt.c ++++ b/lib/launch-libvirt.c +@@ -1396,6 +1396,28 @@ construct_libvirt_xml_devices (guestfs_h *g, + } end_element (); + } end_element (); + ++ /* Virtio-net NIC with SLIRP (= userspace) back-end, if networking is ++ * enabled. Starting with libvirt 3.8.0, we can specify the network address ++ * and prefix for SLIRP in the domain XML. Therefore, we can add the NIC ++ * via the standard element rather than , and ++ * so libvirt can manage the PCI address of the virtio-net NIC like the PCI ++ * addresses of all other devices. Refer to RHBZ#2034160. ++ */ ++ if (g->enable_network && ++ guestfs_int_version_ge (¶ms->data->libvirt_version, 3, 8, 0)) { ++ start_element ("interface") { ++ attribute ("type", "user"); ++ start_element ("model") { ++ attribute ("type", "virtio"); ++ } end_element (); ++ start_element ("ip") { ++ attribute ("family", "ipv4"); ++ attribute ("address", NETWORK_ADDRESS); ++ attribute ("prefix", NETWORK_PREFIX); ++ } end_element (); ++ } end_element (); ++ } ++ + /* Libvirt adds some devices by default. Indicate to libvirt + * that we don't want them. + */ +@@ -1818,9 +1840,10 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g, + } end_element (); + + /* Workaround because libvirt user networking cannot specify "net=" +- * parameter. ++ * parameter. Necessary only before libvirt 3.8.0; refer to RHBZ#2034160. + */ +- if (g->enable_network) { ++ if (g->enable_network && ++ !guestfs_int_version_ge (¶ms->data->libvirt_version, 3, 8, 0)) { + start_element ("qemu:arg") { + attribute ("value", "-netdev"); + } end_element (); +-- +2.31.1 + diff --git a/SPECS/libguestfs.spec b/SPECS/libguestfs.spec index 0bc34f6..6cf69fb 100644 --- a/SPECS/libguestfs.spec +++ b/SPECS/libguestfs.spec @@ -32,7 +32,7 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 Version: 1.44.0 -Release: 4%{?dist} +Release: 5%{?dist} License: LGPLv2+ ExclusiveArch: x86_64 %{power64} aarch64 s390x @@ -66,6 +66,9 @@ Patch0013: 0013-test-data-phony-guests-Fix-phony-RPM-database-fix-vi.patch Patch0014: 0014-po-POTFILES-Fix-list-of-files-for-translation.patch Patch0015: 0015-m4-guestfs-find-db-tool.m4-Remove-unused-file.patch Patch0016: 0016-test-data-phony-guests-Fix-phony-RPM-database-fix-vi.patch +Patch0017: 0017-launch-libvirt-place-our-virtio-net-pci-device-in-sl.patch +Patch0018: 0018-lib-extract-NETWORK_ADDRESS-and-NETWORK_PREFIX-as-ma.patch +Patch0019: 0019-launch-libvirt-add-virtio-net-via-the-standard-inter.patch # Replacement README file. Source4: README-replacement.in @@ -1179,6 +1182,10 @@ rm ocaml/html/.gitignore %changelog +* Fri Dec 24 2021 Richard W.M. Jones - 1:1.44.0-5 +- Fix libguestfs failure with qemu 6.2, libvirt 7.10 + resolves: rhbz#2035177 + * Thu Oct 14 2021 Richard W.M. Jones - 1:1.44.0-4 - Autodetect backing format for qemu-img create -b - Move appliance to separate subpackage