diff --git a/nova/tests/unit/virt/xenapi/test_vif.py b/nova/tests/unit/virt/xenapi/test_vif.py index 552743891500..57a25043ab4d 100644 --- a/nova/tests/unit/virt/xenapi/test_vif.py +++ b/nova/tests/unit/virt/xenapi/test_vif.py @@ -295,7 +295,8 @@ class XenAPIOpenVswitchDriverTestCase(XenVIFDriverTestBase): 'MAC': fake_vif['address'], 'network': 'fake_network', 'other_config': { - 'nicira-iface-id': 'fake-nicira-iface-id'} + 'nicira-iface-id': 'fake-nicira-iface-id', + 'neutron-port-id': 'fake-neutron-port-id'} } mock_VIF_get_record = self.mock_patch_object( self._session.VIF, 'get_record', return_val=fake_vif_rec) @@ -328,7 +329,8 @@ class XenAPIOpenVswitchDriverTestCase(XenVIFDriverTestBase): 'MAC': fake_vif['address'], 'network': 'fake_network', 'other_config': { - 'nicira-iface-id': 'fake-nicira-iface-id'} + 'nicira-iface-id': 'fake-nicira-iface-id', + 'neutron-port-id': 'fake-neutron-port-id'} } mock_VIF_get_record = self.mock_patch_object( self._session.VIF, 'get_record', return_val=fake_vif_rec) diff --git a/nova/tests/unit/virt/xenapi/test_vmops.py b/nova/tests/unit/virt/xenapi/test_vmops.py index 6f8b4c503fec..0ff4d434b937 100644 --- a/nova/tests/unit/virt/xenapi/test_vmops.py +++ b/nova/tests/unit/virt/xenapi/test_vmops.py @@ -1636,8 +1636,8 @@ class LiveMigrateHelperTestCase(VMOpsTestBase): 'get_other_config') as mock_other_config, \ mock.patch.object(self._session.VM, 'get_VIFs') as mock_get_vif: - mock_other_config.side_effect = [{'nicira-iface-id': 'vif_id_a'}, - {'nicira-iface-id': 'vif_id_b'}] + mock_other_config.side_effect = [{'neutron-port-id': 'vif_id_a'}, + {'neutron-port-id': 'vif_id_b'}] mock_get_vif.return_value = ['vif_ref1', 'vif_ref2'] vif_uuid_map = {'vif_id_b': 'dest_net_ref2', 'vif_id_a': 'dest_net_ref1'} @@ -1666,8 +1666,8 @@ class LiveMigrateHelperTestCase(VMOpsTestBase): 'get_other_config') as mock_other_config, \ mock.patch.object(self._session.VM, 'get_VIFs') as mock_get_vif: - mock_other_config.side_effect = [{'nicira-iface-id': 'vif_id_a'}, - {'nicira-iface-id': 'vif_id_b'}] + mock_other_config.side_effect = [{'neutron-port-id': 'vif_id_a'}, + {'neutron-port-id': 'vif_id_b'}] mock_get_vif.return_value = ['vif_ref1', 'vif_ref2'] vif_uuid_map = {'vif_id_c': 'dest_net_ref2', 'vif_id_d': 'dest_net_ref1'} diff --git a/nova/virt/xenapi/vif.py b/nova/virt/xenapi/vif.py index 79ea51040052..1c8ceee25c9f 100644 --- a/nova/virt/xenapi/vif.py +++ b/nova/virt/xenapi/vif.py @@ -274,9 +274,9 @@ class XenAPIOpenVswitchDriver(XenVIFDriver): vif_rec['MTU'] = '1500' vif_rec['qos_algorithm_type'] = '' vif_rec['qos_algorithm_params'] = {} - # OVS on the hypervisor monitors this key and uses it to - # set the iface-id attribute - vif_rec['other_config'] = {'nicira-iface-id': vif['id']} + # Deprecated: 'niciria-iface-id', will remove it in the next release + vif_rec['other_config'] = {'nicira-iface-id': vif['id'], + 'neutron-port-id': vif['id']} vif_ref = self._create_vif(vif, vif_rec, vm_ref) # call XenAPI to plug vif @@ -427,7 +427,7 @@ class XenAPIOpenVswitchDriver(XenVIFDriver): def _create_linux_bridge(self, vif_rec): """create a qbr linux bridge for neutron security group """ - iface_id = vif_rec['other_config']['nicira-iface-id'] + iface_id = vif_rec['other_config']['neutron-port-id'] linux_br_name = self._get_qbr_name(iface_id) if not self._device_exists(linux_br_name): LOG.debug("Create linux bridge %s", linux_br_name) @@ -474,7 +474,7 @@ class XenAPIOpenVswitchDriver(XenVIFDriver): network_ref = vif_rec['network'] bridge_name = self._session.network.get_bridge(network_ref) network_uuid = self._session.network.get_uuid(network_ref) - iface_id = vif_rec['other_config']['nicira-iface-id'] + iface_id = vif_rec['other_config']['neutron-port-id'] patch_port1, tap_name = self._get_patch_port_pair_names(iface_id) LOG.debug('plug_ovs_bridge: port1=%(port1)s, port2=%(port2)s,' 'network_uuid=%(uuid)s, bridge_name=%(bridge_name)s', @@ -552,7 +552,7 @@ class XenAPIOpenVswitchDriver(XenVIFDriver): '''set external ids on the integration bridge vif ''' mac = vif_rec['MAC'] - iface_id = vif_rec['other_config']['nicira-iface-id'] + iface_id = vif_rec['other_config']['neutron-port-id'] vif_uuid = vif_rec['uuid'] status = 'active' diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index e8da8147ca2e..ec1e51543d9e 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -2383,7 +2383,7 @@ class VMOps(object): default_net_ref = vif_uuid_map.get('') for vif in vifs: other_config = self._session.VIF.get_other_config(vif) - neutron_id = other_config.get('nicira-iface-id') + neutron_id = other_config.get('neutron-port-id') network_ref = vif_uuid_map.get(neutron_id, default_net_ref) if network_ref is None: raise exception.MigrationError( diff --git a/releasenotes/notes/deprecate-nicira-iface-id-in-xenserver-dc3c147aef1bc2c8.yaml b/releasenotes/notes/deprecate-nicira-iface-id-in-xenserver-dc3c147aef1bc2c8.yaml new file mode 100644 index 000000000000..5657236016fc --- /dev/null +++ b/releasenotes/notes/deprecate-nicira-iface-id-in-xenserver-dc3c147aef1bc2c8.yaml @@ -0,0 +1,8 @@ +--- +deprecations: + - | + When using neutron polling mode with XenAPI driver, booting a VM will + timeout because ``nova-compute`` cannot receive network-vif-plugged event. + This is because it set vif['id'](i.e. neutron port uuid) to two different + OVS ports. One is XenServer VIF, the other is tap device qvo-XXXX, but + setting 'nicira-iface-id' to XenServer VIF isn't correct, so deprecate it.