From 1d7136f27bb842dde00a2ec0dc2943eb16588cb4 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 14 Aug 2013 15:25:17 +0100
Subject: [PATCH] launch: libvirt: Don't enable <cpu mode="host-model"> on TCG.
It's fairly pointless to do this with TCG, since all we would be doing
is emulating a more complicated processor slowly. Also it may be the
cause of subtle problems we see during testing.
This updates commit 6f76fdb41eb6bd124fbc3d084f5c2a3371b37d9b.
(cherry picked from commit 46763bcc0b9d04ada367f29ca07bd3e11e264a8e)
---
src/launch-libvirt.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
index e6f6b0b..ff3d720 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
@@ -823,17 +823,21 @@ construct_libvirt_xml_cpu (guestfs_h *g,
/* It is faster to pass the CPU host model to the appliance,
* allowing maximum speed for things like checksums, encryption.
* Note this may cause problems on some CPUs. See: RHBZ#870071.
+ * Only do this with KVM. It is broken in subtle ways on TCG, and
+ * fairly pointless anyway.
*/
- XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "cpu"));
- XMLERROR (-1,
- xmlTextWriterWriteAttribute (xo, BAD_CAST "mode",
- BAD_CAST "host-model"));
- XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "model"));
- XMLERROR (-1,
- xmlTextWriterWriteAttribute (xo, BAD_CAST "fallback",
- BAD_CAST "allow"));
- XMLERROR (-1, xmlTextWriterEndElement (xo));
- XMLERROR (-1, xmlTextWriterEndElement (xo));
+ if (params->is_kvm) {
+ XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "cpu"));
+ XMLERROR (-1,
+ xmlTextWriterWriteAttribute (xo, BAD_CAST "mode",
+ BAD_CAST "host-model"));
+ XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "model"));
+ XMLERROR (-1,
+ xmlTextWriterWriteAttribute (xo, BAD_CAST "fallback",
+ BAD_CAST "allow"));
+ XMLERROR (-1, xmlTextWriterEndElement (xo));
+ XMLERROR (-1, xmlTextWriterEndElement (xo));
+ }
XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "vcpu"));
XMLERROR (-1, xmlTextWriterWriteFormatString (xo, "%d", g->smp));
--
1.8.3.1