Skip to content

Commit 76fb811

Browse files
authored
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
1 parent 9d105b6 commit 76fb811

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

agent/bindir/libvirtqemuhook.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,15 @@ def handleMigrateBegin():
6565
bridge = source.getAttribute("bridge")
6666
if isOldStyleBridge(bridge):
6767
vlanId = bridge.replace("cloudVirBr", "")
68+
phyDev = getGuestNetworkDevice()
6869
elif isNewStyleBridge(bridge):
6970
vlanId = re.sub(r"br(\w+)-", "", bridge)
71+
phyDev = re.sub(r"-(\d+)$", "" , re.sub(r"^br", "" ,bridge))
72+
netlib = networkConfig()
73+
if not netlib.isNetworkDev(phyDev):
74+
phyDev = getGuestNetworkDevice()
7075
else:
7176
continue
72-
phyDev = getGuestNetworkDevice()
7377
newBrName = "br" + phyDev + "-" + vlanId
7478
source.setAttribute("bridge", newBrName)
7579
print(domain.toxml())

0 commit comments

Comments
 (0)