weizhouapache commented on code in PR #7482:
URL: https://github.com/apache/cloudstack/pull/7482#discussion_r1184752423


##########
agent/bindir/libvirtqemuhook.in:
##########
@@ -61,21 +61,23 @@ def handleMigrateBegin():
     try:
         domain = parse(sys.stdin)
         for interface in domain.getElementsByTagName("interface"):
-            source = interface.getElementsByTagName("source")[0]
-            bridge = source.getAttribute("bridge")
-            if isOldStyleBridge(bridge):
-                vlanId = bridge.replace("cloudVirBr", "")
-                phyDev = getGuestNetworkDevice()
-            elif isNewStyleBridge(bridge):
-                vlanId = re.sub(r"br(\w+)-", "", bridge)
-                phyDev = re.sub(r"-(\d+)$", "" , re.sub(r"^br", "" ,bridge))
-                netlib = networkConfig()
-                if not netlib.isNetworkDev(phyDev):
+            sources = interface.getElementsByTagName("source")
+            if sources.length > 0:
+                source = interface.getElementsByTagName("source")[0]
+                bridge = source.getAttribute("bridge")
+                if isOldStyleBridge(bridge):
+                    vlanId = bridge.replace("cloudVirBr", "")
                     phyDev = getGuestNetworkDevice()
-            else:
-                continue
-            newBrName = "br" + phyDev + "-" + vlanId
-            source.setAttribute("bridge", newBrName)
+                elif isNewStyleBridge(bridge):
+                    vlanId = re.sub(r"br(\w+)-", "", bridge)
+                    phyDev = re.sub(r"-(\d+)$", "" , re.sub(r"^br", "" 
,bridge))
+                    netlib = networkConfig()
+                    if not netlib.isNetworkDev(phyDev):
+                        phyDev = getGuestNetworkDevice()
+                else:
+                    continue
+                newBrName = "br" + phyDev + "-" + vlanId
+                source.setAttribute("bridge", newBrName)
         print(domain.toxml())

Review Comment:
   +1 with @mlsorensen 
   
   It is not a bug, actually we must use 'print'



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to