Resolve rhbz#2030709, rhbz#2034160
- Add detection support for Rocky Linux - Resolve conflict between manual and libvirt-assigned PCI addresses resolves: rhbz#2030709, rhbz#2034160 Signed-off-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
975798ac9b
commit
96381bce89
@ -35,5 +35,5 @@ index 557f32833..652bacc0f 100644
|
|||||||
| "rhel" -> Some DISTRO_RHEL
|
| "rhel" -> Some DISTRO_RHEL
|
||||||
| "sles" | "sled" -> Some DISTRO_SLES
|
| "sles" | "sled" -> Some DISTRO_SLES
|
||||||
--
|
--
|
||||||
2.31.1
|
2.19.1.3.g30247aa5d201
|
||||||
|
|
@ -96,5 +96,5 @@ index 690afd460..0c6d39b43 100644
|
|||||||
|
|
||||||
Linux Mint.
|
Linux Mint.
|
||||||
--
|
--
|
||||||
2.31.1
|
2.19.1.3.g30247aa5d201
|
||||||
|
|
||||||
|
@ -0,0 +1,209 @@
|
|||||||
|
From a98532ac7d6c79889703603d9f4ab008f0febd53 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Neil Hanlon <neil@resf.org>
|
||||||
|
Date: Fri, 10 Dec 2021 08:50:48 +0000
|
||||||
|
Subject: [PATCH] Add detection support for Rocky Linux (CentOS/RHEL-like)
|
||||||
|
|
||||||
|
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2030709
|
||||||
|
Thanks: label@rockylinux.org
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
RWMJ notes: I fixed the original patch so it compiled. This patch
|
||||||
|
sets osinfo to "rocky8", which doesn't exist in the osinfo db yet.
|
||||||
|
Arguably we might want to set this to "centos8", but we can see what
|
||||||
|
libosinfo decides to do. Here is partial virt-inspector output on a
|
||||||
|
Rocky Linux disk image:
|
||||||
|
|
||||||
|
$ ./run virt-inspector -a disk.img
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<operatingsystems>
|
||||||
|
<operatingsystem>
|
||||||
|
<root>/dev/rl/root</root>
|
||||||
|
<name>linux</name>
|
||||||
|
<arch>x86_64</arch>
|
||||||
|
<distro>rocky</distro>
|
||||||
|
<product_name>Rocky Linux 8.5 (Green Obsidian)</product_name>
|
||||||
|
<major_version>8</major_version>
|
||||||
|
<minor_version>5</minor_version>
|
||||||
|
<package_format>rpm</package_format>
|
||||||
|
<package_management>dnf</package_management>
|
||||||
|
<hostname>localhost.localdomain</hostname>
|
||||||
|
<osinfo>rocky8</osinfo>
|
||||||
|
<mountpoints>
|
||||||
|
<mountpoint dev="/dev/rl/root">/</mountpoint>
|
||||||
|
<mountpoint dev="/dev/sda1">/boot</mountpoint>
|
||||||
|
</mountpoints>
|
||||||
|
<filesystems>
|
||||||
|
<filesystem dev="/dev/rl/root">
|
||||||
|
<type>xfs</type>
|
||||||
|
<uuid>fed8331f-9f25-40cd-883e-090cd640559d</uuid>
|
||||||
|
</filesystem>
|
||||||
|
<filesystem dev="/dev/rl/swap">
|
||||||
|
<type>swap</type>
|
||||||
|
<uuid>6da2c121-ea7d-49ce-98a3-14a37fceaadd</uuid>
|
||||||
|
</filesystem>
|
||||||
|
<filesystem dev="/dev/sda1">
|
||||||
|
<type>xfs</type>
|
||||||
|
<uuid>4efafe61-2d20-4d93-8055-537e09bfd033</uuid>
|
||||||
|
</filesystem>
|
||||||
|
</filesystems>
|
||||||
|
(cherry picked from commit 631962c0e88a321646846be91d0fbea1ba14e263)
|
||||||
|
---
|
||||||
|
daemon/inspect_fs.ml | 2 ++
|
||||||
|
daemon/inspect_fs_unix.ml | 13 ++++++++++++-
|
||||||
|
daemon/inspect_types.ml | 2 ++
|
||||||
|
daemon/inspect_types.mli | 1 +
|
||||||
|
generator/actions_inspection.ml | 4 ++++
|
||||||
|
lib/inspect-icon.c | 1 +
|
||||||
|
lib/inspect-osinfo.c | 4 ++++
|
||||||
|
7 files changed, 26 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/daemon/inspect_fs.ml b/daemon/inspect_fs.ml
|
||||||
|
index 77f0f6aea..9c73d97ef 100644
|
||||||
|
--- a/daemon/inspect_fs.ml
|
||||||
|
+++ b/daemon/inspect_fs.ml
|
||||||
|
@@ -259,6 +259,7 @@ and check_package_format { distro } =
|
||||||
|
| None -> None
|
||||||
|
| Some DISTRO_ALTLINUX
|
||||||
|
| Some DISTRO_CENTOS
|
||||||
|
+ | Some DISTRO_ROCKY
|
||||||
|
| Some DISTRO_FEDORA
|
||||||
|
| Some DISTRO_MAGEIA
|
||||||
|
| Some DISTRO_MANDRIVA
|
||||||
|
@@ -329,6 +330,7 @@ and check_package_management { distro; version } =
|
||||||
|
Some PACKAGE_MANAGEMENT_DNF
|
||||||
|
|
||||||
|
| Some DISTRO_CENTOS
|
||||||
|
+ | Some DISTRO_ROCKY
|
||||||
|
| Some DISTRO_ORACLE_LINUX
|
||||||
|
| Some DISTRO_REDHAT_BASED
|
||||||
|
| Some DISTRO_RHEL
|
||||||
|
diff --git a/daemon/inspect_fs_unix.ml b/daemon/inspect_fs_unix.ml
|
||||||
|
index 7f6eb92e9..63cb279d0 100644
|
||||||
|
--- a/daemon/inspect_fs_unix.ml
|
||||||
|
+++ b/daemon/inspect_fs_unix.ml
|
||||||
|
@@ -32,6 +32,8 @@ let re_rhel_no_minor = PCRE.compile "Red Hat.*release (\\d+)"
|
||||||
|
let re_centos_old = PCRE.compile "CentOS.*release (\\d+).*Update (\\d+)"
|
||||||
|
let re_centos = PCRE.compile "CentOS.*release (\\d+)\\.(\\d+)"
|
||||||
|
let re_centos_no_minor = PCRE.compile "CentOS.*release (\\d+)"
|
||||||
|
+let re_rocky = PCRE.compile "Rocky Linux.*release (\\d+)\\.(\\d+)"
|
||||||
|
+let re_rocky_no_minor = PCRE.compile "Rocky Linux.*release (\\d+)"
|
||||||
|
let re_scientific_linux_old =
|
||||||
|
PCRE.compile "Scientific Linux.*release (\\d+).*Update (\\d+)"
|
||||||
|
let re_scientific_linux =
|
||||||
|
@@ -106,7 +108,7 @@ let rec parse_os_release release_file data =
|
||||||
|
* we detect that situation then bail out and use the release
|
||||||
|
* files instead.
|
||||||
|
*)
|
||||||
|
- | { distro = Some (DISTRO_DEBIAN|DISTRO_CENTOS);
|
||||||
|
+ | { distro = Some (DISTRO_DEBIAN|DISTRO_CENTOS|DISTRO_ROCKY);
|
||||||
|
version = Some (_, 0) } ->
|
||||||
|
false
|
||||||
|
|
||||||
|
@@ -155,6 +157,7 @@ and distro_of_os_release_id = function
|
||||||
|
| "pardus" -> Some DISTRO_PARDUS
|
||||||
|
| "pld" -> Some DISTRO_PLD_LINUX
|
||||||
|
| "rhel" -> Some DISTRO_RHEL
|
||||||
|
+ | "rocky" -> Some DISTRO_ROCKY
|
||||||
|
| "sles" | "sled" -> Some DISTRO_SLES
|
||||||
|
| "ubuntu" -> Some DISTRO_UBUNTU
|
||||||
|
| "void" -> Some DISTRO_VOID_LINUX
|
||||||
|
@@ -405,6 +408,10 @@ let linux_root_tests : tests = [
|
||||||
|
DISTRO_CENTOS;
|
||||||
|
"/etc/centos-release", parse_generic ~rex:re_centos_no_minor
|
||||||
|
DISTRO_CENTOS;
|
||||||
|
+ "/etc/rocky-release", parse_generic ~rex:re_rocky
|
||||||
|
+ DISTRO_ROCKY;
|
||||||
|
+ "/etc/rocky-release", parse_generic ~rex:re_rocky_no_minor
|
||||||
|
+ DISTRO_ROCKY;
|
||||||
|
"/etc/altlinux-release", parse_generic DISTRO_ALTLINUX;
|
||||||
|
"/etc/redhat-release", parse_generic ~rex:re_fedora
|
||||||
|
DISTRO_FEDORA;
|
||||||
|
@@ -420,6 +427,10 @@ let linux_root_tests : tests = [
|
||||||
|
DISTRO_CENTOS;
|
||||||
|
"/etc/redhat-release", parse_generic ~rex:re_centos_no_minor
|
||||||
|
DISTRO_CENTOS;
|
||||||
|
+ "/etc/redhat-release", parse_generic ~rex:re_rocky
|
||||||
|
+ DISTRO_ROCKY;
|
||||||
|
+ "/etc/redhat-release", parse_generic ~rex:re_rocky_no_minor
|
||||||
|
+ DISTRO_ROCKY;
|
||||||
|
"/etc/redhat-release", parse_generic ~rex:re_scientific_linux_old
|
||||||
|
DISTRO_SCIENTIFIC_LINUX;
|
||||||
|
"/etc/redhat-release", parse_generic ~rex:re_scientific_linux
|
||||||
|
diff --git a/daemon/inspect_types.ml b/daemon/inspect_types.ml
|
||||||
|
index e2bc7165c..9395c51f9 100644
|
||||||
|
--- a/daemon/inspect_types.ml
|
||||||
|
+++ b/daemon/inspect_types.ml
|
||||||
|
@@ -95,6 +95,7 @@ and distro =
|
||||||
|
| DISTRO_PLD_LINUX
|
||||||
|
| DISTRO_REDHAT_BASED
|
||||||
|
| DISTRO_RHEL
|
||||||
|
+ | DISTRO_ROCKY
|
||||||
|
| DISTRO_SCIENTIFIC_LINUX
|
||||||
|
| DISTRO_SLACKWARE
|
||||||
|
| DISTRO_SLES
|
||||||
|
@@ -228,6 +229,7 @@ and string_of_distro = function
|
||||||
|
| DISTRO_PLD_LINUX -> "pldlinux"
|
||||||
|
| DISTRO_REDHAT_BASED -> "redhat-based"
|
||||||
|
| DISTRO_RHEL -> "rhel"
|
||||||
|
+ | DISTRO_ROCKY -> "rocky"
|
||||||
|
| DISTRO_SCIENTIFIC_LINUX -> "scientificlinux"
|
||||||
|
| DISTRO_SLACKWARE -> "slackware"
|
||||||
|
| DISTRO_SLES -> "sles"
|
||||||
|
diff --git a/daemon/inspect_types.mli b/daemon/inspect_types.mli
|
||||||
|
index 43c79818f..29c76e8ab 100644
|
||||||
|
--- a/daemon/inspect_types.mli
|
||||||
|
+++ b/daemon/inspect_types.mli
|
||||||
|
@@ -102,6 +102,7 @@ and distro =
|
||||||
|
| DISTRO_PLD_LINUX
|
||||||
|
| DISTRO_REDHAT_BASED
|
||||||
|
| DISTRO_RHEL
|
||||||
|
+ | DISTRO_ROCKY
|
||||||
|
| DISTRO_SCIENTIFIC_LINUX
|
||||||
|
| DISTRO_SLACKWARE
|
||||||
|
| DISTRO_SLES
|
||||||
|
diff --git a/generator/actions_inspection.ml b/generator/actions_inspection.ml
|
||||||
|
index 0c6d39b43..f8b744993 100644
|
||||||
|
--- a/generator/actions_inspection.ml
|
||||||
|
+++ b/generator/actions_inspection.ml
|
||||||
|
@@ -278,6 +278,10 @@ Some Red Hat-derived distro.
|
||||||
|
|
||||||
|
Red Hat Enterprise Linux.
|
||||||
|
|
||||||
|
+=item \"rocky\"
|
||||||
|
+
|
||||||
|
+Rocky Linux.
|
||||||
|
+
|
||||||
|
=item \"scientificlinux\"
|
||||||
|
|
||||||
|
Scientific Linux.
|
||||||
|
diff --git a/lib/inspect-icon.c b/lib/inspect-icon.c
|
||||||
|
index 725af574b..3bffa4f80 100644
|
||||||
|
--- a/lib/inspect-icon.c
|
||||||
|
+++ b/lib/inspect-icon.c
|
||||||
|
@@ -138,6 +138,7 @@ guestfs_impl_inspect_get_icon (guestfs_h *g, const char *root, size_t *size_r,
|
||||||
|
else if (STREQ (distro, "rhel") ||
|
||||||
|
STREQ (distro, "redhat-based") ||
|
||||||
|
STREQ (distro, "centos") ||
|
||||||
|
+ STREQ (distro, "rocky") ||
|
||||||
|
STREQ (distro, "scientificlinux") ||
|
||||||
|
STREQ (distro, "oraclelinux")) {
|
||||||
|
r = icon_rhel (g, guestfs_inspect_get_major_version (g, root), &size);
|
||||||
|
diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c
|
||||||
|
index db38d87f7..90e57e6df 100644
|
||||||
|
--- a/lib/inspect-osinfo.c
|
||||||
|
+++ b/lib/inspect-osinfo.c
|
||||||
|
@@ -47,6 +47,10 @@ guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root)
|
||||||
|
else if (major == 6)
|
||||||
|
return safe_asprintf (g, "%s%d.%d", distro, major, minor);
|
||||||
|
}
|
||||||
|
+ else if (STREQ (distro, "rocky")) {
|
||||||
|
+ if (major >= 8)
|
||||||
|
+ return safe_asprintf (g, "%s%d", distro, major);
|
||||||
|
+ }
|
||||||
|
else if (STREQ (distro, "debian")) {
|
||||||
|
if (major >= 4)
|
||||||
|
return safe_asprintf (g, "%s%d", distro, major);
|
||||||
|
--
|
||||||
|
2.19.1.3.g30247aa5d201
|
||||||
|
|
@ -0,0 +1,65 @@
|
|||||||
|
From 43e0fdd6cb94370e74b1214c7550aa98b8307409 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Laszlo Ersek <lersek@redhat.com>
|
||||||
|
Date: Thu, 23 Dec 2021 11:36:59 +0100
|
||||||
|
Subject: [PATCH] launch-libvirt: place our virtio-net-pci device in slot 0x1e
|
||||||
|
|
||||||
|
The <qemu:commandline> 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
|
||||||
|
<https://libvirt.org/formatdomain.html#controllers>.
|
||||||
|
|
||||||
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160
|
||||||
|
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||||
|
Message-Id: <20211223103701.12702-2-lersek@redhat.com>
|
||||||
|
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
Tested-by: Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
(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 4097b33fd..8eb2dd3ad 100644
|
||||||
|
--- a/lib/guestfs-internal.h
|
||||||
|
+++ b/lib/guestfs-internal.h
|
||||||
|
@@ -172,6 +172,17 @@ cleanup_mutex_unlock (pthread_mutex_t **ptr)
|
||||||
|
#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 194530c49..9e8336938 100644
|
||||||
|
--- a/lib/launch-libvirt.c
|
||||||
|
+++ b/lib/launch-libvirt.c
|
||||||
|
@@ -1851,7 +1851,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.19.1.3.g30247aa5d201
|
||||||
|
|
@ -0,0 +1,70 @@
|
|||||||
|
From 80899629519139a7eb86842942a9471d05eb4112 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Laszlo Ersek <lersek@redhat.com>
|
||||||
|
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 <lersek@redhat.com>
|
||||||
|
Message-Id: <20211223103701.12702-3-lersek@redhat.com>
|
||||||
|
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
Tested-by: Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
(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 8eb2dd3ad..e24d570f5 100644
|
||||||
|
--- a/lib/guestfs-internal.h
|
||||||
|
+++ b/lib/guestfs-internal.h
|
||||||
|
@@ -183,6 +183,12 @@ cleanup_mutex_unlock (pthread_mutex_t **ptr)
|
||||||
|
#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 e5b9a5611..4f038f4f0 100644
|
||||||
|
--- a/lib/launch-direct.c
|
||||||
|
+++ b/lib/launch-direct.c
|
||||||
|
@@ -689,7 +689,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 9e8336938..266d88824 100644
|
||||||
|
--- a/lib/launch-libvirt.c
|
||||||
|
+++ b/lib/launch-libvirt.c
|
||||||
|
@@ -1843,7 +1843,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.19.1.3.g30247aa5d201
|
||||||
|
|
@ -0,0 +1,91 @@
|
|||||||
|
From a18bc12081bcebf2d78883d1c6981c454149bb39 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Laszlo Ersek <lersek@redhat.com>
|
||||||
|
Date: Thu, 23 Dec 2021 11:37:01 +0100
|
||||||
|
Subject: [PATCH] launch-libvirt: add virtio-net via the standard <interface>
|
||||||
|
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
|
||||||
|
<interface> element in the domain XML:
|
||||||
|
<https://libvirt.org/formatdomain.html#userspace-slirp-stack>. This means
|
||||||
|
we don't need the <qemu:commandline> 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 <interface> 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 <rjones@redhat.com>
|
||||||
|
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||||
|
Message-Id: <20211223103701.12702-4-lersek@redhat.com>
|
||||||
|
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
Tested-by: Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
(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 e24d570f5..4a19e5c6b 100644
|
||||||
|
--- a/lib/guestfs-internal.h
|
||||||
|
+++ b/lib/guestfs-internal.h
|
||||||
|
@@ -173,7 +173,8 @@ cleanup_mutex_unlock (pthread_mutex_t **ptr)
|
||||||
|
#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 266d88824..cc714c02e 100644
|
||||||
|
--- a/lib/launch-libvirt.c
|
||||||
|
+++ b/lib/launch-libvirt.c
|
||||||
|
@@ -1413,6 +1413,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 <interface> element rather than <qemu:commandline>, 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.
|
||||||
|
*/
|
||||||
|
@@ -1835,9 +1857,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.19.1.3.g30247aa5d201
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
From 4ac1f94cd17b7e2cc301ae2d63dff25d4529f30b Mon Sep 17 00:00:00 2001
|
From dabee87775ee919a8ae930ca5f03c7bb4b7616e6 Mon Sep 17 00:00:00 2001
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
Date: Fri, 21 Dec 2012 15:50:11 +0000
|
Date: Fri, 21 Dec 2012 15:50:11 +0000
|
||||||
Subject: [PATCH] RHEL: Remove libguestfs live (RHBZ#798980).
|
Subject: [PATCH] RHEL: Remove libguestfs live (RHBZ#798980).
|
||||||
@ -51,5 +51,5 @@ index 690e09b5e..919e2f248 100644
|
|||||||
daemon/test-daemon-start.pl \
|
daemon/test-daemon-start.pl \
|
||||||
daemon/test-btrfs.pl
|
daemon/test-btrfs.pl
|
||||||
--
|
--
|
||||||
2.31.1
|
2.19.1.3.g30247aa5d201
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
From f0dce483f0d4bc49c6df6d056f3f4321754fa32d Mon Sep 17 00:00:00 2001
|
From 8d426264789f4b2ab5557087a39973e6fbc20983 Mon Sep 17 00:00:00 2001
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
Date: Thu, 18 Jul 2013 18:31:53 +0100
|
Date: Thu, 18 Jul 2013 18:31:53 +0100
|
||||||
Subject: [PATCH] RHEL: Remove 9p APIs from RHEL (RHBZ#921710).
|
Subject: [PATCH] RHEL: Remove 9p APIs from RHEL (RHBZ#921710).
|
||||||
@ -325,5 +325,5 @@ index 919e2f248..e3613fec4 100644
|
|||||||
|
|
||||||
SLOW_TESTS += bigdirs/test-big-dirs.pl
|
SLOW_TESTS += bigdirs/test-big-dirs.pl
|
||||||
--
|
--
|
||||||
2.31.1
|
2.19.1.3.g30247aa5d201
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
From bf090c70aae831b2827b262bd93d1d0fd60850e6 Mon Sep 17 00:00:00 2001
|
From cb18280888d6ab9e840b79ec93eeecf11127b6e6 Mon Sep 17 00:00:00 2001
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
Date: Mon, 29 Jul 2013 14:47:56 +0100
|
Date: Mon, 29 Jul 2013 14:47:56 +0100
|
||||||
Subject: [PATCH] RHEL: Disable unsupported remote drive protocols
|
Subject: [PATCH] RHEL: Disable unsupported remote drive protocols
|
||||||
@ -605,5 +605,5 @@ index 12937fb30..b3e4f9903 100755
|
|||||||
-grep -sq -- '-drive file=ssh://rich@example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail
|
-grep -sq -- '-drive file=ssh://rich@example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail
|
||||||
-rm "$DEBUG_QEMU_FILE"
|
-rm "$DEBUG_QEMU_FILE"
|
||||||
--
|
--
|
||||||
2.31.1
|
2.19.1.3.g30247aa5d201
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
From fca6730bb7f4f82414061e50df173b35e00bad8f Mon Sep 17 00:00:00 2001
|
From 1bb653591b25ac31ef773e0020cd0b0e5715d5cf Mon Sep 17 00:00:00 2001
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
Date: Fri, 19 Sep 2014 13:38:20 +0100
|
Date: Fri, 19 Sep 2014 13:38:20 +0100
|
||||||
Subject: [PATCH] RHEL: Remove User-Mode Linux (RHBZ#1144197).
|
Subject: [PATCH] RHEL: Remove User-Mode Linux (RHBZ#1144197).
|
||||||
@ -68,5 +68,5 @@ index 5aec50a57..8b9fcd770 100644
|
|||||||
static int
|
static int
|
||||||
shutdown_uml (guestfs_h *g, void *datav, int check_for_errors)
|
shutdown_uml (guestfs_h *g, void *datav, int check_for_errors)
|
||||||
--
|
--
|
||||||
2.31.1
|
2.19.1.3.g30247aa5d201
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
From ce2e49114bde6edc4a14648ee51adbbf199aa482 Mon Sep 17 00:00:00 2001
|
From 6372b9cd8bb2d8a183fc6d2ca4688047a0474c2f Mon Sep 17 00:00:00 2001
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
Date: Tue, 7 Jul 2015 09:28:03 -0400
|
Date: Tue, 7 Jul 2015 09:28:03 -0400
|
||||||
Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for
|
Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for
|
||||||
@ -65,5 +65,5 @@ index 105291dc3..5ca4f3b6d 100644
|
|||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
||||||
--
|
--
|
||||||
2.31.1
|
2.19.1.3.g30247aa5d201
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
From bf0d0053627df26cb3d3d96563856e6b7fb34b32 Mon Sep 17 00:00:00 2001
|
From c50bb81e40b36a74c15f9bc515a2f04a1eb00673 Mon Sep 17 00:00:00 2001
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
Date: Tue, 29 Jun 2021 15:29:11 +0100
|
Date: Tue, 29 Jun 2021 15:29:11 +0100
|
||||||
Subject: [PATCH] RHEL: Create /etc/crypto-policies/back-ends/opensslcnf.config
|
Subject: [PATCH] RHEL: Create /etc/crypto-policies/back-ends/opensslcnf.config
|
||||||
@ -28,5 +28,5 @@ index 7076821d2..fe6497b4d 100755
|
|||||||
|
|
||||||
# Set up kmod static-nodes (RHBZ#1011907).
|
# Set up kmod static-nodes (RHBZ#1011907).
|
||||||
--
|
--
|
||||||
2.31.1
|
2.19.1.3.g30247aa5d201
|
||||||
|
|
@ -57,7 +57,7 @@ Summary: Access and modify virtual machine disk images
|
|||||||
Name: libguestfs
|
Name: libguestfs
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 1.46.1
|
Version: 1.46.1
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
|
|
||||||
# Build only for architectures that have a kernel
|
# Build only for architectures that have a kernel
|
||||||
@ -95,14 +95,18 @@ Source8: copy-patches.sh
|
|||||||
# https://github.com/libguestfs/libguestfs/commits/rhel-9.0.0
|
# https://github.com/libguestfs/libguestfs/commits/rhel-9.0.0
|
||||||
|
|
||||||
# Patches.
|
# Patches.
|
||||||
Patch0001: 0001-daemon-inspect_fs_unix-recognize-modern-Pardus-GNU-L.patch
|
Patch0001: 0001-daemon-inspect_fs_unix-recognize-modern-Pardus-GNU-Linux-releases.patch
|
||||||
Patch0002: 0002-daemon-inspection-Add-support-for-Kylin-RHBZ-1995391.patch
|
Patch0002: 0002-daemon-inspection-Add-support-for-Kylin-RHBZ-1995391.patch
|
||||||
Patch0003: 0003-RHEL-Remove-libguestfs-live-RHBZ-798980.patch
|
Patch0003: 0003-Add-detection-support-for-Rocky-Linux-CentOS-RHEL-like.patch
|
||||||
Patch0004: 0004-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
|
Patch0004: 0004-launch-libvirt-place-our-virtio-net-pci-device-in-slot-0x1e.patch
|
||||||
Patch0005: 0005-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch
|
Patch0005: 0005-lib-extract-NETWORK_ADDRESS-and-NETWORK_PREFIX-as-macros.patch
|
||||||
Patch0006: 0006-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch
|
Patch0006: 0006-launch-libvirt-add-virtio-net-via-the-standard-interface-element.patch
|
||||||
Patch0007: 0007-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
|
Patch0007: 0007-RHEL-Remove-libguestfs-live-RHBZ-798980.patch
|
||||||
Patch0008: 0008-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.patch
|
Patch0008: 0008-RHEL-Remove-9p-APIs-from-RHEL-RHBZ-921710.patch
|
||||||
|
Patch0009: 0009-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ-962113.patch
|
||||||
|
Patch0010: 0010-RHEL-Remove-User-Mode-Linux-RHBZ-1144197.patch
|
||||||
|
Patch0011: 0011-RHEL-Reject-use-of-libguestfs-winsupport-features-except-for-virt-tools-RHBZ-1240276.patch
|
||||||
|
Patch0012: 0012-RHEL-Create-etc-crypto-policies-back-ends-opensslcnf.config.patch
|
||||||
|
|
||||||
%if 0%{patches_touch_autotools}
|
%if 0%{patches_touch_autotools}
|
||||||
BuildRequires: autoconf, automake, libtool, gettext-devel
|
BuildRequires: autoconf, automake, libtool, gettext-devel
|
||||||
@ -1142,6 +1146,12 @@ rm ocaml/html/.gitignore
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Dec 23 2021 Laszlo Ersek <lersek@redhat.com> - 1:1.46.1-2
|
||||||
|
- Add detection support for Rocky Linux
|
||||||
|
resolves: rhbz#2030709
|
||||||
|
- Resolve conflict between manual and libvirt-assigned PCI addresses
|
||||||
|
resolves: rhbz#2034160
|
||||||
|
|
||||||
* Thu Dec 09 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.46.1-1
|
* Thu Dec 09 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.46.1-1
|
||||||
- Rebase to new stable branch version 1.46.1
|
- Rebase to new stable branch version 1.46.1
|
||||||
resolves: rhbz#2011711
|
resolves: rhbz#2011711
|
||||||
|
Loading…
Reference in New Issue
Block a user