[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu: Don't lose VM runtime state on libvirt downgrade



Run libvirtd from git with latest qemu, start a VM, stop libvirtd.
Run an older libvirtd version an you may see an error like:

qemuDomainObjPrivateXMLParse:857 : internal error: Unknown qemu capabilities flag device-tray-moved-event

Libvirt finds a cached capabilities flag it doesn't understand, and
fails to parse the VM runtime state. It now thinks the VM isn't
running, when it is. This is potentially serious since it could
lead to disk corruption if the VM is re-run.

For the common case of unknown qemu capabilities flags, treat an
unknown flag as non-fatal and continue on
---
 src/qemu/qemu_domain.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b0eb3b6..dbf8124 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1411,18 +1411,18 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
             goto error;
 
         for (i = 0; i < n; i++) {
+            int flag;
             char *str = virXMLPropString(nodes[i], "name");
-            if (str) {
-                int flag = virQEMUCapsTypeFromString(str);
-                if (flag < 0) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unknown qemu capabilities flag %s"), str);
-                    VIR_FREE(str);
-                    goto error;
-                }
-                VIR_FREE(str);
+            if (!str)
+                continue;
+
+            flag = virQEMUCapsTypeFromString(str);
+            if (flag < 0) {
+                VIR_WARN("Unknown qemu capabilities flag %s", str);
+            } else {
                 virQEMUCapsSet(qemuCaps, flag);
             }
+            VIR_FREE(str);
         }
 
         priv->qemuCaps = qemuCaps;
-- 
2.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]