[PATCH 19/37] virDomainNetDefParseXML: Refactor parsing of data for VIR_DOMAIN_NET_TYPE_INTERNAL

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

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cdf94ac75d..0c97be1766 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8999,7 +8999,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
     g_autofree char *localport = NULL;
     g_autofree char *model = NULL;
     g_autofree char *filter = NULL;
-    g_autofree char *internal = NULL;
     g_autofree char *mode = NULL;
     g_autofree char *linkstate = NULL;
     g_autofree char *addrtype = NULL;
@@ -9076,9 +9075,11 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
         break;

     case VIR_DOMAIN_NET_TYPE_INTERNAL:
-        if (source_node) {
-            internal = virXMLPropString(source_node, "name");
-        }
+        if (virDomainNetDefParseXMLRequireSource(def, source_node) < 0)
+            return NULL;
+
+        if (!(def->data.internal.name = virXMLPropStringRequired(source_node, "name")))
+            return NULL;
         break;

     case VIR_DOMAIN_NET_TYPE_BRIDGE:
@@ -9399,13 +9400,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
         break;

     case VIR_DOMAIN_NET_TYPE_INTERNAL:
-        if (internal == NULL) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("No <source> 'name' attribute specified "
-                             "with <interface type='internal'/>"));
-            return NULL;
-        }
-        def->data.internal.name = g_steal_pointer(&internal);
         break;

     case VIR_DOMAIN_NET_TYPE_DIRECT:
-- 
2.37.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