appliance: Use <cpu mode="maximum"/> 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 30f74f38bd
This commit is contained in:
Richard W.M. Jones
2021-03-18 12:32:26 +00:00
parent 24e112c1b7
commit 13ceb6a87b

View File

@@ -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);