Richard W.M. Jones
2015-Jan-21 13:13 UTC
[Libguestfs] [PATCH] aarch64: launch: libvirt: As a workaround, pass -cpu parameter to qemu.
From: "Richard W.M. Jones" <rjones@redhat.com> When libguestfs is running using TCG on aarch64, we need to pass the -cpu cortex-a57 parameter to qemu. Libvirt doesn't let us do this, complaining "Unable to find CPU definition". As a temporary workaround only, use <qemu:commandline> to pass this argument directly to qemu. When libvirt is fixed we can remove this hack. This is a workaround for libvirt bug RHBZ#1184411. See: https://www.redhat.com/archives/libvirt-users/2014-August/msg00043.html https://bugzilla.redhat.com/show_bug.cgi?id=1184411 --- src/launch-libvirt.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c index 7a57f30..ca12320 100644 --- a/src/launch-libvirt.c +++ b/src/launch-libvirt.c @@ -1085,12 +1085,16 @@ construct_libvirt_xml_cpu (guestfs_h *g, } end_element (); } else { - /* XXX This does not work, see: + /* XXX This does not work on aarch64, see: * https://www.redhat.com/archives/libvirt-users/2014-August/msg00043.html + * https://bugzilla.redhat.com/show_bug.cgi?id=1184411 + * Instead we hack around it using <qemu:commandline> below. */ +#ifndef __aarch64__ start_element ("model") { string (cpu_model); } end_element (); +#endif } } end_element (); } @@ -1728,6 +1732,21 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g, } } +#ifdef __aarch64__ + /* This is a temporary hack until RHBZ#1184411 is resolved. + * See comments above about cpu model and aarch64. + */ + const char *cpu_model = guestfs___get_cpu_model (params->data->is_kvm); + if (STRNEQ (cpu_model, "host")) { + start_element ("qemu:arg") { + attribute ("value", "-cpu"); + } end_element (); + start_element ("qemu:arg") { + attribute ("value", cpu_model); + } end_element (); + } +#endif + } end_element (); /* </qemu:commandline> */ return 0; -- 1.8.3.1
Possibly Parallel Threads
- [PATCH v2 2/4] common/utils: Move libxml2 writer macros to a common header file.
- [PATCH v3 4/4] lib, p2v: Use single_element() macro where possible.
- [PATCH INCOMPLETE] launch: libvirt: Use C macros to simplify XML generation.
- [PATCH 2/2] launch: libvirt: Use qemu-bridge-helper to implement a full network (RHBZ#1148012).
- [PATCH] aarch64: appliance: Use AAVMF (UEFI) if available for running the appliance.