diff --git a/0001-appliance-Use-cpu-mode-maximum-for-cpu-max-on-libvir.patch b/0001-appliance-Use-cpu-mode-maximum-for-cpu-max-on-libvir.patch new file mode 100644 index 0000000..9c7e099 --- /dev/null +++ b/0001-appliance-Use-cpu-mode-maximum-for-cpu-max-on-libvir.patch @@ -0,0 +1,47 @@ +From 13ceb6a87b2869909a6a0e3c8caa962b72e4cb0e Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 18 Mar 2021 12:32:26 +0000 +Subject: [PATCH] appliance: Use for -cpu max on libvirt. + +Note this requires libvirt >= 7.1.0 which was only released in March 2021. + +With an older libvirt you will see this error: + + Original error from libvirt: unsupported configuration: Invalid mode attribute 'maximum' [code=67 int1=-1] + +In theory we could check if this is supported by looking at the +libvirt capabilities and fall back, but this commit does not do that, +in the expectation that most people will be using the default backend +(direct) and on Fedora/RHEL we will add an explicit minimum version +dependency to the package. + +qemu support has been around quite a bit longer (at least since 2017). + +Fixes: commit 30f74f38bd6e42e783ba80895f4d6826abddd417 +--- + lib/launch-libvirt.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c +index 2d995bee0..194530c49 100644 +--- a/lib/launch-libvirt.c ++++ b/lib/launch-libvirt.c +@@ -1183,13 +1183,8 @@ construct_libvirt_xml_cpu (guestfs_h *g, + } end_element (); + } + else if (STREQ (cpu_model, "max")) { +- if (params->data->is_kvm) +- attribute ("mode", "host-passthrough"); +- else +- attribute ("mode", "host-model"); +- start_element ("model") { +- attribute ("fallback", "allow"); +- } end_element (); ++ /* https://bugzilla.redhat.com/show_bug.cgi?id=1935572#c11 */ ++ attribute ("mode", "maximum"); + } + else + single_element ("model", cpu_model); +-- +2.29.0.rc2 + diff --git a/libguestfs.spec b/libguestfs.spec index 788be61..3c72a04 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -56,7 +56,7 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 Version: 1.45.1 -Release: 5%{?dist} +Release: 6%{?dist} License: LGPLv2+ # Build only for architectures that have a kernel @@ -92,6 +92,11 @@ Patch0: %{name}-php8.patch # Remove dependency on perl(Sys::Virt) (upstream in libguestfs >= 1.45.2) Patch1: 0001-tests-Remove-dependency-on-Sys-Virt.patch +# Fix -cpu max mode with libvirt backend. +# Upstream in libguestfs >= 1.45.2. +# Requires libvirt >= 7.1.0 +Patch2: 0001-appliance-Use-cpu-mode-maximum-for-cpu-max-on-libvir.patch + %if 0%{patches_touch_autotools} BuildRequires: autoconf, automake, libtool, gettext-devel %endif @@ -134,7 +139,7 @@ BuildRequires: unzip BuildRequires: systemd-units BuildRequires: netpbm-progs BuildRequires: icoutils -BuildRequires: libvirt-daemon-kvm >= 5.3.0 +BuildRequires: libvirt-daemon-kvm >= 7.1.0 %if !0%{?rhel} BuildRequires: perl(Expect) %endif @@ -328,7 +333,7 @@ Suggests: qemu-block-iscsi Suggests: qemu-block-rbd Suggests: qemu-block-ssh Recommends: libvirt-daemon-config-network -Requires: libvirt-daemon-driver-qemu +Requires: libvirt-daemon-driver-qemu >= 7.1.0 Requires: libvirt-daemon-driver-secret Recommends: libvirt-daemon-driver-storage-core Requires: selinux-policy >= 3.11.1-63 @@ -1310,8 +1315,9 @@ rm ocaml/html/.gitignore %changelog -* Thu Mar 18 2021 Richard W.M. Jones - 1:1.45.1-5 +* Thu Mar 18 2021 Richard W.M. Jones - 1:1.45.1-6 - Drop dependency on perl(Sys::Virt). +- Fix -cpu max and require libvirt >= 7.1.0. * Wed Mar 10 2021 Richard W.M. Jones - 1:1.45.1-4 - Drop Requires: libvirt-daemon-kvm, pulls in the whole of qemu and subpkgs.