This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.13
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.13 by this push:
     new 76fb811  kvm: Fix router migration issue when router has 
control/public nics on other physical network than guest (#3855)
76fb811 is described below

commit 76fb811e08b2e4e48bb310df4f0b2b12f82203a7
Author: Wei Zhou <[email protected]>
AuthorDate: Fri Jan 31 10:44:35 2020 +0100

    kvm: Fix router migration issue when router has control/public nics on 
other physical network than guest (#3855)
    
    In VM migration on KVM, libvirt qemu hook script will change the bridge 
name to bridges for guest networks. It works for user vm. However for virtual 
router, it has nics on control network and public network. If control/public 
use different physical networks than guest network, virtual router cannot be 
migrated.
    
    Fixes: #2783
---
 agent/bindir/libvirtqemuhook.in | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/agent/bindir/libvirtqemuhook.in b/agent/bindir/libvirtqemuhook.in
index 27e0711..894d68c 100755
--- a/agent/bindir/libvirtqemuhook.in
+++ b/agent/bindir/libvirtqemuhook.in
@@ -65,11 +65,15 @@ def handleMigrateBegin():
             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):
+                    phyDev = getGuestNetworkDevice()
             else:
                 continue
-            phyDev = getGuestNetworkDevice()
             newBrName = "br" + phyDev + "-" + vlanId
             source.setAttribute("bridge", newBrName)
         print(domain.toxml())

Reply via email to