From 76fb811e08b2e4e48bb310df4f0b2b12f82203a7 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Fri, 31 Jan 2020 10:44:35 +0100 Subject: [PATCH] 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 27e07119ccc..894d68c7b0b 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())