]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Accept <allowReboot value='default'/>
authorAndrea Bolognani <abologna@redhat.com>
Thu, 24 Mar 2022 18:47:16 +0000 (19:47 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 5 Apr 2022 11:40:28 +0000 (13:40 +0200)
Up until a few commits ago, libvirt produced this XML and so
we need to be able to read it back to prevent a bunch of

  error : virXMLPropEnumInternal:516 : XML error: Invalid value
  for attribute 'value' in element 'allowReboot': 'default'

messages from being logged on daemon upgrade when there are
running guests.

Fixes: 0fe2d8dd335054fae38b46bbbac58a4662e1a1d0
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_domain.c

index 39da3cbb627268f9f1de6739befff6518aba450e..820a6a8a61e1966a6f70973576a242552b4fbc0e 100644 (file)
@@ -2859,9 +2859,12 @@ qemuDomainObjPrivateXMLParseAllowReboot(xmlXPathContextPtr ctxt,
 {
     xmlNodePtr node = virXPathNode("./allowReboot", ctxt);
 
-    return virXMLPropTristateBool(node, "value",
-                                  VIR_XML_PROP_NONE,
-                                  allowReboot);
+    /* Allow value='default' as the input here, because old versions
+     * of libvirt produced that output and we need to be able to read
+     * it back to correctly handle running guests on daemon upgrade */
+    return virXMLPropTristateBoolAllowDefault(node, "value",
+                                              VIR_XML_PROP_NONE,
+                                              allowReboot);
 }