[libvirt PATCH v2 45/51] backup_conf: Use virXMLPropTristateXXX in virDomainBackupDiskDefParseXML

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/backup_conf.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
index ba58b2e322..ce85ed8bad 100644
--- a/src/conf/backup_conf.c
+++ b/src/conf/backup_conf.c
@@ -106,7 +106,6 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node,
     g_autofree char *type = NULL;
     g_autofree char *format = NULL;
     g_autofree char *idx = NULL;
-    g_autofree char *backup = NULL;
     g_autofree char *state = NULL;
     g_autofree char *backupmode = NULL;
     int tmp;
@@ -125,17 +124,10 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node,
         return -1;
     }
 
-    def->backup = VIR_TRISTATE_BOOL_YES;
-
-    if ((backup = virXMLPropString(node, "backup"))) {
-        if ((tmp = virTristateBoolTypeFromString(backup)) <= 0) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           _("invalid disk 'backup' state '%s'"), backup);
-            return -1;
-        }
-
-        def->backup = tmp;
-    }
+    if (virXMLPropTristateBool(node, "backup", false, &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)
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux