[libvirt] [PATCH 1/9] conf: split interface target element condition

Ján Tomko jtomko at redhat.com
Mon May 21 15:37:11 UTC 2018


Check for the 'dev' attribute in a separate condition, to make
parsing future attributes easier.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/conf/domain_conf.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3689ac0a82..c0a8ae7898 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11069,15 +11069,16 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
                     }
                     ctxt->node = tmpnode;
                 }
-            } else if (!ifname &&
-                       virXMLNodeNameEqual(cur, "target")) {
-                ifname = virXMLPropString(cur, "dev");
-                if (ifname &&
-                    (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
-                    (STRPREFIX(ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
-                     (prefix && STRPREFIX(ifname, prefix)))) {
-                    /* An auto-generated target name, blank it out */
-                    VIR_FREE(ifname);
+            } else if (virXMLNodeNameEqual(cur, "target")) {
+                if (!ifname) {
+                    ifname = virXMLPropString(cur, "dev");
+                    if (ifname &&
+                        (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
+                        (STRPREFIX(ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
+                         (prefix && STRPREFIX(ifname, prefix)))) {
+                        /* An auto-generated target name, blank it out */
+                        VIR_FREE(ifname);
+                    }
                 }
             } else if ((!ifname_guest || !ifname_guest_actual) &&
                        virXMLNodeNameEqual(cur, "guest")) {
-- 
2.16.1




More information about the libvir-list mailing list