9119d9
From 4bba1d479ff2e68a3c69bcc6e8c482d07ec728d9 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <4bba1d479ff2e68a3c69bcc6e8c482d07ec728d9@dist-git>
9119d9
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
9119d9
Date: Thu, 11 Dec 2014 13:28:09 +0100
9119d9
Subject: [PATCH] Do not format CPU features without a model
9119d9
9119d9
For host-passthrough CPU we don't honor the CPU
9119d9
features specified in the XML, but we allow
9119d9
outputting them via the UPDATE_CPU flag for dumpxml,
9119d9
this gives user a rough idea of what features the CPU
9119d9
might have.
9119d9
9119d9
After restoring a managedsave'd domain, the features
9119d9
might end up in the live status XML (in /var/run) without
9119d9
the model. This XML cannot be parsed by the daemon after
9119d9
restart and the domain might disappear.
9119d9
9119d9
This fix skips formatting the features for HOST_PASSTHROUGH
9119d9
when UPDATE_CPU is not specified, so the newly restored domains
9119d9
and newly created snapshots won't be affected.
9119d9
9119d9
Note: this doesn't fix existing snapshots or already restored
9119d9
running domains.
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1030793
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1151885
9119d9
(cherry picked from commit dd324bb2703b9cf619c521b2a04f186cd9734f0a)
9119d9
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/conf/cpu_conf.c | 2 +-
9119d9
 1 file changed, 1 insertion(+), 1 deletion(-)
9119d9
9119d9
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
9119d9
index e190641..72555a7 100644
9119d9
--- a/src/conf/cpu_conf.c
9119d9
+++ b/src/conf/cpu_conf.c
9119d9
@@ -664,7 +664,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
9119d9
         virBufferAddLit(buf, "/>\n");
9119d9
     }
9119d9
 
9119d9
-    for (i = 0; i < def->nfeatures; i++) {
9119d9
+    for (i = 0; formatModel && i < def->nfeatures; i++) {
9119d9
         virCPUFeatureDefPtr feature = def->features + i;
9119d9
 
9119d9
         if (!feature->name) {
9119d9
-- 
9119d9
2.2.0
9119d9