[libvirt PATCH 09/38] domain_conf: Use virXMLProp(OnOff|YesNo) in virDomainDiskDefDriverParseXML

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e3e38ae30d..8dbf371e81 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9126,6 +9126,9 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
                                xmlXPathContextPtr ctxt)
 {
     g_autofree char *tmp = NULL;
+    virTristateSwitch ioeventfd = VIR_TRISTATE_SWITCH_ABSENT;
+    virTristateSwitch event_idx = VIR_TRISTATE_SWITCH_ABSENT;
+    virTristateSwitch copy_on_read = VIR_TRISTATE_SWITCH_ABSENT;
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
 
     ctxt->node = cur;
@@ -9165,29 +9168,17 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
     }
     VIR_FREE(tmp);
 
-    if ((tmp = virXMLPropString(cur, "ioeventfd")) &&
-        (def->ioeventfd = virTristateSwitchTypeFromString(tmp)) <= 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("unknown disk ioeventfd mode '%s'"), tmp);
+    if (virXMLPropOnOff(cur, "ioeventfd", &ioeventfd) < 0)
         return -1;
-    }
-    VIR_FREE(tmp);
+    def->ioeventfd = ioeventfd;
 
-    if ((tmp = virXMLPropString(cur, "event_idx")) &&
-        (def->event_idx = virTristateSwitchTypeFromString(tmp)) <= 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("unknown disk event_idx mode '%s'"), tmp);
+    if (virXMLPropOnOff(cur, "event_idx", &event_idx) < 0)
         return -1;
-    }
-    VIR_FREE(tmp);
+    def->event_idx = event_idx;
 
-    if ((tmp = virXMLPropString(cur, "copy_on_read")) &&
-        (def->copy_on_read = virTristateSwitchTypeFromString(tmp)) <= 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("unknown disk copy_on_read mode '%s'"), tmp);
+    if (virXMLPropOnOff(cur, "copy_on_read", &copy_on_read) < 0)
         return -1;
-    }
-    VIR_FREE(tmp);
+    def->copy_on_read = copy_on_read;
 
     if ((tmp = virXMLPropString(cur, "discard")) &&
         (def->discard = virDomainDiskDiscardTypeFromString(tmp)) <= 0) {
-- 
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