[libvirt] [PATCH v1 06/51] util: conf: separate virDomainDefParseSecurityLabelInfo from virDomainDefParseXML

xinhua.Cao caoxinhua at huawei.com
Thu Feb 8 06:46:04 UTC 2018


separate virDomainDefParseSecurityLabelInfo from virDomainDefParseXML
---
 src/conf/domain_conf.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2daa6df..64b6c09 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18746,6 +18746,25 @@ virDomainDefParseDomainInfo(virDomainParseTotalParamPtr param)
 }
 
 
+static int
+virDomainDefParseSecurityLabelInfo(virDomainParseTotalParamPtr param)
+{
+    /* analysis of security label, done early even though we format it
+     * late, so devices can refer to this for defaults */
+    if (!(param->flags & VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL)) {
+        if (virSecurityLabelDefsParseXML(param->def,
+                                         param->ctxt,
+                                         param->caps,
+                                         param->flags) == -1)
+            return -1;
+    }
+
+    return 0;
+
+}
+
+
+
 static virDomainDefPtr
 virDomainDefParseXML(xmlDocPtr xml,
                      xmlNodePtr root,
@@ -18790,6 +18809,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             virDomainDefParseVirtTypeInfo,
             virDomainDefParseOsNodeInfo,
             virDomainDefParseDomainInfo,
+            virDomainDefParseSecurityLabelInfo,
             NULL
     };
 
@@ -18817,13 +18837,6 @@ virDomainDefParseXML(xmlDocPtr xml,
         fun_index++;
     }
 
-    /* analysis of security label, done early even though we format it
-     * late, so devices can refer to this for defaults */
-    if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL)) {
-        if (virSecurityLabelDefsParseXML(def, ctxt, caps, flags) == -1)
-            goto error;
-    }
-
     /* Extract domain memory */
     if (virDomainParseMemory("./memory[1]", NULL, ctxt,
                              &def->mem.total_memory, false, true) < 0)
-- 
2.8.3





More information about the libvir-list mailing list