cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 002296a
Date Wed, 26 Aug 2015 09:30:03 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 65e9ea998 -> 002296ac4


CLOUDSTACK-8765: fix vm migration failure due to different dev name on KVM


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bb8f7c65
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bb8f7c65
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bb8f7c65

Branch: refs/heads/master
Commit: bb8f7c652e42caacff5adce1ce60342603677605
Parents: 82df5b1
Author: Wei Zhou <w.zhou@tech.leaseweb.com>
Authored: Mon Aug 24 14:28:13 2015 +0200
Committer: Wei Zhou <w.zhou@tech.leaseweb.com>
Committed: Mon Aug 24 14:28:13 2015 +0200

----------------------------------------------------------------------
 agent/bindir/libvirtqemuhook.in | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bb8f7c65/agent/bindir/libvirtqemuhook.in
----------------------------------------------------------------------
diff --git a/agent/bindir/libvirtqemuhook.in b/agent/bindir/libvirtqemuhook.in
index 7bf9634..3f290c6 100755
--- a/agent/bindir/libvirtqemuhook.in
+++ b/agent/bindir/libvirtqemuhook.in
@@ -16,6 +16,7 @@
 # specific language governing permissions and limitations
 # under the License.
 import sys
+import re
 from xml.dom.minidom import parse
 from cloudutils.configFileOps import configFileOps
 from cloudutils.networkConfig import networkConfig
@@ -24,21 +25,29 @@ def isOldStyleBridge(brName):
        return True
     else:
        return False
+def isNewStyleBridge(brName):
+    if re.match(r"br(\w+)-(\d+)", brName) == None:
+       return False
+    else:
+       return True
 def getGuestNetworkDevice():
     netlib = networkConfig() 
     cfo = configFileOps("/etc/cloudstack/agent/agent.properties")
     guestDev = cfo.getEntry("guest.network.device")
     enslavedDev = netlib.getEnslavedDev(guestDev, 1)
-    return enslavedDev 
+    return enslavedDev.split(".")[0]
 def handleMigrateBegin():
     try:
         domain = parse(sys.stdin)
         for interface in domain.getElementsByTagName("interface"):
             source = interface.getElementsByTagName("source")[0]
             bridge = source.getAttribute("bridge")
-            if not isOldStyleBridge(bridge):
+            if isOldStyleBridge(bridge):
+                vlanId = bridge.replace("cloudVirBr","")
+            elif isNewStyleBridge(bridge):
+                vlanId = re.sub(r"br(\w+)-","",bridge)
+            else:
                 continue
-            vlanId = bridge.replace("cloudVirBr","")
             phyDev = getGuestNetworkDevice()
             newBrName="br" + phyDev + "-" + vlanId
             source.setAttribute("bridge", newBrName)


Mime
View raw message