[PATCH 11/17] virDomainDiskDefParseSourceXML: Switch to virXMLPropEnumDefault()

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

 



The virDomainDiskDefParseSourceXML() function uses old style of
parsing XML (virXMLPropString + str2enum conversion). Use
virXMLPropEnumDefault() which encapsulates those steps.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c42ac9c0c9..44b507b74d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9039,15 +9039,11 @@ virDomainDiskDefParseSourceXML(virDomainXMLOption *xmlopt,
         if (virDomainStorageSourceParse(tmp, ctxt, src, flags, xmlopt) < 0)
             return NULL;
 
-        if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) {
-            g_autofree char *sourceindex = NULL;
-
-            if ((sourceindex = virXMLPropString(tmp, "index")) &&
-                virStrToLong_uip(sourceindex, NULL, 10, &src->id) < 0) {
-                virReportError(VIR_ERR_XML_ERROR,
-                               _("invalid disk index '%s'"), sourceindex);
-                return NULL;
-            }
+        if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
+            virXMLPropUInt(tmp, "index", 10,
+                           VIR_XML_PROP_NONE,
+                           &src->id) < 0) {
+            return NULL;
         }
     } else {
         /* Reset src->type in case when 'source' was not present */
-- 
2.35.1




[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