[libvirt PATCH v2 36/51] domain_conf: Use virXMLPropTristateXXX 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 | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 976bdb0172..72c98cc5a2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14212,8 +14212,6 @@ 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;
 
     def = g_new0(virDomainMemballoonDef, 1);
 
@@ -14230,19 +14228,12 @@ 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 (virXMLPropTristateSwitch(node, "autodeflate", false, &def->autodeflate) < 0)
         goto error;
-    }
 
-    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 (virXMLPropTristateSwitch(node, "freePageReporting", false,
+                                 &def->free_page_reporting) < 0)
         goto error;
-    }
 
     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