[OVS] Fix for cleaning after skipped_devices

When Openvswitch agent will get "port_update" event
(e.g. to set port as unbound) and port is already removed
from br-int when agent tries to get vif port in
treat_devices_added_updated() method (port is removed
because e.g. nova-compute removes it) then resources set
for port by L2 agent extension drivers (like qos) are not
cleaned properly.

In such case port is added to skipped_ports and is set
as DOWN in neutron-db but ext_manager is not called then
for such port so it will not clear stuff like bandwidth
limit's QoS and queue records and also DSCP marking
open flow rules for this port.

This patch fixes this issue by adding call of
ext_manager.delete_port() method for all skipped ports.

Change-Id: I3cf5c57c7f232deaa190ab6b0129e398fdabe592
Closes-Bug: #1737892
(cherry picked from commit a8271e978a)
This commit is contained in:
Sławek Kapłoński 2018-01-12 23:08:56 +01:00 committed by Nate Johnston
parent e3ff53e3fc
commit cdcc704b9e
2 changed files with 5 additions and 0 deletions

View File

@ -1548,6 +1548,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
# The port disappeared and cannot be processed
LOG.info("Port %s was not found on the integration bridge "
"and will therefore not be processed", device)
self.ext_manager.delete_port(self.context, {'port_id': device})
skipped_devices.append(device)
continue

View File

@ -866,12 +866,16 @@ class TestOvsNeutronAgent(object):
mock.patch.object(self.agent.int_br,
'get_vifs_by_ids',
return_value={}),\
mock.patch.object(self.agent.ext_manager,
"delete_port") as ext_mgr_delete_port,\
mock.patch.object(self.agent,
'treat_vif_port') as treat_vif_port:
skip_devs = self.agent.treat_devices_added_or_updated([], False)
# The function should return False for resync and no device
# processed
self.assertEqual((['the_skipped_one'], [], set()), skip_devs)
ext_mgr_delete_port.assert_called_once_with(
self.agent.context, {'port_id': 'the_skipped_one'})
self.assertFalse(treat_vif_port.called)
def test_treat_devices_added_failed_devices(self):