[libvirt] [PATCH] Use UPDATE_CPU when saving domain status

Ján Tomko jtomko at redhat.com
Fri Oct 31 15:29:07 UTC 2014


We only format cpu model for MODE_CUSTOM in domain status XML,
but we always format features if they are present.

This is a problem if we have a domain using MODE_HOST_PASSTHROUGH
that has been managedsaved, then restored, since it now has
a feature list but no model in /var/run/libvirt/qemu.

Use UPDATE_CPU even for the status XML to prevent libvirt
from losing track of the domain.

Also accept a list of features for HOST_PASSTHROUGH even without
a model specified, to catch domains started with older libvirtd.
(We already accept the list of features with a model specified,
 even though they have no effect for HOST_PASSTHROUGH)

https://bugzilla.redhat.com/show_bug.cgi?id=1030793
https://bugzilla.redhat.com/show_bug.cgi?id=1151885
---
 src/conf/cpu_conf.c    | 2 +-
 src/conf/domain_conf.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 9b7fbb0..96e1c38 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -625,7 +625,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
                        (def->mode == VIR_CPU_MODE_CUSTOM && def->model)));
 
     if (!def->model &&
-        def->mode != VIR_CPU_MODE_HOST_MODEL &&
+        def->mode == VIR_CPU_MODE_CUSTOM &&
         def->nfeatures) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Non-empty feature list specified without CPU model"));
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a351382..414161c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19621,6 +19621,7 @@ virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
                     virDomainObjPtr obj)
 {
     unsigned int flags = (VIR_DOMAIN_XML_SECURE |
+                          VIR_DOMAIN_XML_UPDATE_CPU |
                           VIR_DOMAIN_XML_INTERNAL_STATUS |
                           VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
                           VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
-- 
2.0.4




More information about the libvir-list mailing list