[PATCH 09/17] virDomainBackupDiskDefParseXML: Fill default backup state after parsing it

Peter Krempa pkrempa at redhat.com
Thu May 6 15:31:01 UTC 2021


Set the backup mode to VIR_TRISTATE_BOOL_YES after virXMLPropTristateBool
left it set to VIR_TRISTATE_BOOL_ABSENT. This will allow fixing
virXMLPropTristateBool to always initialize @result.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/backup_conf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
index 7f176b783f..ac92bd4f26 100644
--- a/src/conf/backup_conf.c
+++ b/src/conf/backup_conf.c
@@ -121,12 +121,13 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node,
         return -1;
     }

-    def->backup = VIR_TRISTATE_BOOL_YES;
-
     if (virXMLPropTristateBool(node, "backup", VIR_XML_PROP_NONE,
                                &def->backup) < 0)
         return -1;

+    if (def->backup == VIR_TRISTATE_BOOL_ABSENT)
+        def->backup = VIR_TRISTATE_BOOL_YES;
+
     /* don't parse anything else if backup is disabled */
     if (def->backup == VIR_TRISTATE_BOOL_NO)
         return 0;
-- 
2.30.2




More information about the libvir-list mailing list