Merge "Trigger port status DOWN on VIF replug" into stable/ocata

This commit is contained in:
Zuul 2019-04-25 14:22:40 +00:00 committed by Gerrit Code Review
commit d843b5274e
2 changed files with 19 additions and 2 deletions

View File

@ -1396,7 +1396,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
return self._get_port_info(registered_ports, cur_ports, sync)
def check_changed_vlans(self):
"""Return ports which have lost their vlan tag.
"""Check for changed VLAN tags. If changes, notify server and return.
The returned value is a set of port ids of the ports concerned by a
vlan tag loss.
@ -1416,6 +1416,18 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
'vlan_tag': lvm.vlan}
)
changed_ports.add(port.vif_id)
if changed_ports:
# explicitly mark these DOWN on the server since they have been
# manipulated (likely a nova unplug/replug) and need to be rewired
devices_down = self.plugin_rpc.update_device_list(self.context,
[],
changed_ports,
self.agent_id,
self.conf.host)
failed_devices = set(devices_down.get('failed_devices_down'))
if failed_devices:
LOG.debug("Status updated failed for %s", failed_devices)
return changed_ports
def treat_vif_port(self, vif_port, port_id, network_id, network_type,

View File

@ -620,10 +620,15 @@ class TestOvsNeutronAgent(object):
added=set([3]), current=vif_port_set,
removed=set([2]), updated=set([1])
)
with mock.patch.object(self.agent, 'tun_br', autospec=True):
with mock.patch.object(self.agent, 'tun_br', autospec=True), \
mock.patch.object(self.agent.plugin_rpc,
'update_device_list') as upd_l:
actual = self.mock_scan_ports(
vif_port_set, registered_ports, port_tags_dict=port_tags_dict)
self.assertEqual(expected, actual)
upd_l.assert_called_once_with(mock.ANY, [], set([1]),
self.agent.agent_id,
self.agent.conf.host)
def test_update_retries_map_and_remove_devs_not_to_retry(self):
failed_devices_retries_map = {