XenAPI: Deprecate nicira-iface-id for XenServer VIF

When using neutron polling mode, booting a VM will timeout because cannot
receive network-vif-plugged event. After investigation we found we set
vif['id'](i.e. neutron port uuid from neutron's perspective of view) to
two different OVS ports. One is the Xenserver VIF, the other is tap device
qvo-XXXX which neutron ovs agent will monitor and deal with.
This patch is to deprecate the setting of 'nicira-iface-id' to XenServer
VIF (which will result in 'iface-id' in ovsdb) and use 'neutron-port-id'.
Note: There is no problem if we don't use neutron-ovs-agent polling mode

Change-Id: I878602b5a84106634a211735c0002580293e3c06
This commit is contained in:
Huan Xie 2017-05-07 22:38:00 -07:00
parent 9f8c9ab613
commit d0d546ce8e
5 changed files with 23 additions and 13 deletions

View File

@ -279,7 +279,8 @@ class XenAPIOpenVswitchDriverTestCase(XenVIFDriverTestBase):
'MAC': fake_vif['address'], 'MAC': fake_vif['address'],
'network': 'fake_network', 'network': 'fake_network',
'other_config': { '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( mock_VIF_get_record = self.mock_patch_object(
self._session.VIF, 'get_record', return_val=fake_vif_rec) self._session.VIF, 'get_record', return_val=fake_vif_rec)
@ -312,7 +313,8 @@ class XenAPIOpenVswitchDriverTestCase(XenVIFDriverTestBase):
'MAC': fake_vif['address'], 'MAC': fake_vif['address'],
'network': 'fake_network', 'network': 'fake_network',
'other_config': { '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( mock_VIF_get_record = self.mock_patch_object(
self._session.VIF, 'get_record', return_val=fake_vif_rec) self._session.VIF, 'get_record', return_val=fake_vif_rec)

View File

@ -1636,8 +1636,8 @@ class LiveMigrateHelperTestCase(VMOpsTestBase):
'get_other_config') as mock_other_config, \ 'get_other_config') as mock_other_config, \
mock.patch.object(self._session.VM, mock.patch.object(self._session.VM,
'get_VIFs') as mock_get_vif: 'get_VIFs') as mock_get_vif:
mock_other_config.side_effect = [{'nicira-iface-id': 'vif_id_a'}, mock_other_config.side_effect = [{'neutron-port-id': 'vif_id_a'},
{'nicira-iface-id': 'vif_id_b'}] {'neutron-port-id': 'vif_id_b'}]
mock_get_vif.return_value = ['vif_ref1', 'vif_ref2'] mock_get_vif.return_value = ['vif_ref1', 'vif_ref2']
vif_uuid_map = {'vif_id_b': 'dest_net_ref2', vif_uuid_map = {'vif_id_b': 'dest_net_ref2',
'vif_id_a': 'dest_net_ref1'} 'vif_id_a': 'dest_net_ref1'}
@ -1666,8 +1666,8 @@ class LiveMigrateHelperTestCase(VMOpsTestBase):
'get_other_config') as mock_other_config, \ 'get_other_config') as mock_other_config, \
mock.patch.object(self._session.VM, mock.patch.object(self._session.VM,
'get_VIFs') as mock_get_vif: 'get_VIFs') as mock_get_vif:
mock_other_config.side_effect = [{'nicira-iface-id': 'vif_id_a'}, mock_other_config.side_effect = [{'neutron-port-id': 'vif_id_a'},
{'nicira-iface-id': 'vif_id_b'}] {'neutron-port-id': 'vif_id_b'}]
mock_get_vif.return_value = ['vif_ref1', 'vif_ref2'] mock_get_vif.return_value = ['vif_ref1', 'vif_ref2']
vif_uuid_map = {'vif_id_c': 'dest_net_ref2', vif_uuid_map = {'vif_id_c': 'dest_net_ref2',
'vif_id_d': 'dest_net_ref1'} 'vif_id_d': 'dest_net_ref1'}

View File

@ -268,9 +268,9 @@ class XenAPIOpenVswitchDriver(XenVIFDriver):
vif_rec['MTU'] = '1500' vif_rec['MTU'] = '1500'
vif_rec['qos_algorithm_type'] = '' vif_rec['qos_algorithm_type'] = ''
vif_rec['qos_algorithm_params'] = {} vif_rec['qos_algorithm_params'] = {}
# OVS on the hypervisor monitors this key and uses it to # Deprecated: 'niciria-iface-id', will remove it in the next release
# set the iface-id attribute vif_rec['other_config'] = {'nicira-iface-id': vif['id'],
vif_rec['other_config'] = {'nicira-iface-id': vif['id']} 'neutron-port-id': vif['id']}
vif_ref = self._create_vif(vif, vif_rec, vm_ref) vif_ref = self._create_vif(vif, vif_rec, vm_ref)
# call XenAPI to plug vif # call XenAPI to plug vif
@ -421,7 +421,7 @@ class XenAPIOpenVswitchDriver(XenVIFDriver):
def _create_linux_bridge(self, vif_rec): def _create_linux_bridge(self, vif_rec):
"""create a qbr linux bridge for neutron security group """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) linux_br_name = self._get_qbr_name(iface_id)
if not self._device_exists(linux_br_name): if not self._device_exists(linux_br_name):
LOG.debug("Create linux bridge %s", linux_br_name) LOG.debug("Create linux bridge %s", linux_br_name)
@ -468,7 +468,7 @@ class XenAPIOpenVswitchDriver(XenVIFDriver):
network_ref = vif_rec['network'] network_ref = vif_rec['network']
bridge_name = self._session.network.get_bridge(network_ref) bridge_name = self._session.network.get_bridge(network_ref)
network_uuid = self._session.network.get_uuid(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) patch_port1, tap_name = self._get_patch_port_pair_names(iface_id)
LOG.debug('plug_ovs_bridge: port1=%(port1)s, port2=%(port2)s,' LOG.debug('plug_ovs_bridge: port1=%(port1)s, port2=%(port2)s,'
'network_uuid=%(uuid)s, bridge_name=%(bridge_name)s', 'network_uuid=%(uuid)s, bridge_name=%(bridge_name)s',
@ -546,7 +546,7 @@ class XenAPIOpenVswitchDriver(XenVIFDriver):
'''set external ids on the integration bridge vif '''set external ids on the integration bridge vif
''' '''
mac = vif_rec['MAC'] 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'] vif_uuid = vif_rec['uuid']
status = 'active' status = 'active'

View File

@ -2383,7 +2383,7 @@ class VMOps(object):
default_net_ref = vif_uuid_map.get('') default_net_ref = vif_uuid_map.get('')
for vif in vifs: for vif in vifs:
other_config = self._session.VIF.get_other_config(vif) 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) network_ref = vif_uuid_map.get(neutron_id, default_net_ref)
if network_ref is None: if network_ref is None:
raise exception.MigrationError( raise exception.MigrationError(

View File

@ -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.