From 203a97fbe99a0b9c22b678258cc407763fbd3cba Mon Sep 17 00:00:00 2001 From: Apollon Oikonomopoulos Date: Wed, 2 Dec 2015 14:35:42 +0200 Subject: [PATCH] KVM: explicitly configure routed NICs late Commit cc8a8ed7 outlined the reasons for configuring bridged NICs early during live migration and routed NICs after migration has been finished. Back then these were the only types of NICs available, however with the introduction of OVS support this has changed. Since OVS bridges are essentially bridges, the considerations outlined in cc8a8ed7 still apply: in particular, we do not want to lose the gratuitous ARP sent out by the KVM NICs, so we have to configure the OVS interfaces early in the migration process as well. Rather than explicitly configure bridged and OVS interfaces early, we prefer to explicitly configure routed interfaces late, since this leads to more compact code. Signed-off-by: Apollon Oikonomopoulos Signed-off-by: Klaus Aehlig Reviewed-by: Klaus Aehlig --- lib/hypervisor/hv_kvm.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index cc175b4..47eaa48 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -1935,11 +1935,12 @@ class KVMHypervisor(hv_base.BaseHypervisor): kvm_cmd.extend(["-qmp", "unix:%s,server,nowait" % self._InstanceQmpMonitor(instance.name)]) - # Configure the network now for starting instances and bridged interfaces, - # during FinalizeMigration for incoming instances' routed interfaces + # Configure the network now for starting instances and bridged/OVS + # interfaces, during FinalizeMigration for incoming instances' routed + # interfaces. for nic_seq, nic in enumerate(kvm_nics): if (incoming and - nic.nicparams[constants.NIC_MODE] != constants.NIC_MODE_BRIDGED): + nic.nicparams[constants.NIC_MODE] == constants.NIC_MODE_ROUTED): continue self._ConfigureNIC(instance, nic_seq, nic, taps[nic_seq]) @@ -2422,8 +2423,8 @@ class KVMHypervisor(hv_base.BaseHypervisor): kvm_nics = kvm_runtime[1] for nic_seq, nic in enumerate(kvm_nics): - if nic.nicparams[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED: - # Bridged interfaces have already been configured + if nic.nicparams[constants.NIC_MODE] != constants.NIC_MODE_ROUTED: + # Bridged/OVS interfaces have already been configured continue try: tap = utils.ReadFile(self._InstanceNICFile(instance.name, nic_seq)) -- 1.7.10.4