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

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

 



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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fe35a3960e..0c4f7ab879 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14264,8 +14264,8 @@ virDomainMemballoonDefParseXML(virDomainXMLOptionPtr xmlopt,
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
     unsigned int period = 0;
     g_autofree char *model = NULL;
-    g_autofree char *freepage_reporting = NULL;
-    g_autofree char *deflate = NULL;
+    virTristateSwitch autodeflate = VIR_TRISTATE_SWITCH_ABSENT;
+    virTristateSwitch free_page_reporting = VIR_TRISTATE_SWITCH_ABSENT;
 
     def = g_new0(virDomainMemballoonDef, 1);
 
@@ -14282,19 +14282,13 @@ virDomainMemballoonDefParseXML(virDomainXMLOptionPtr xmlopt,
         goto error;
     }
 
-    if ((deflate = virXMLPropString(node, "autodeflate")) &&
-        (def->autodeflate = virTristateSwitchTypeFromString(deflate)) <= 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("invalid autodeflate attribute value '%s'"), deflate);
+    if (virXMLPropOnOff(node, "autodeflate", &autodeflate) < 0)
         goto error;
-    }
+    def->autodeflate = autodeflate;
 
-    if ((freepage_reporting = virXMLPropString(node, "freePageReporting")) &&
-        (def->free_page_reporting = virTristateSwitchTypeFromString(freepage_reporting)) <= 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("invalid freePageReporting attribute value '%s'"), freepage_reporting);
+    if (virXMLPropOnOff(node, "freePageReporting", &free_page_reporting) < 0)
         goto error;
-    }
+    def->free_page_reporting = free_page_reporting;
 
     ctxt->node = node;
     if (virXPathUInt("string(./stats/@period)", ctxt, &period) < -1) {
-- 
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