Call ext_manager.delete_port on port removal
This patch updates OVSNeutronAgent to call ext_manager.delete_port when the port is removed (similar to how CommonAgentLoop does). Otherwise the QoS PortPolicyMap is not properly updated on port removal and QoS extension will not apply policies if that port is later reused by a VM on the same node (unless the agent is restarted). Change-Id: I306c496985a550176d0ddc6eb33a4a4d351acb55 Closes-Bug: #1515533
This commit is contained in:
parent
73a06b9988
commit
bc47fe97d3
|
@ -1577,6 +1577,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
|
|||
failed_devices = set(devices_down.get('failed_devices_down'))
|
||||
LOG.debug("Port removal failed for %s", failed_devices)
|
||||
for device in devices:
|
||||
self.ext_manager.delete_port(self.context, {'port_id': device})
|
||||
self.port_unbound(device)
|
||||
return failed_devices
|
||||
|
||||
|
|
|
@ -865,6 +865,21 @@ class TestOvsNeutronAgent(object):
|
|||
failed_devices['removed'] = self.agent.treat_devices_removed([{}])
|
||||
self.assertEqual(set([dev_mock]), failed_devices.get('removed'))
|
||||
|
||||
def test_treat_devices_removed_ext_delete_port(self):
|
||||
port_id = 'fake-id'
|
||||
|
||||
m_delete = mock.patch.object(self.agent.ext_manager, 'delete_port')
|
||||
m_rpc = mock.patch.object(self.agent.plugin_rpc, 'update_device_list',
|
||||
return_value={'devices_up': [],
|
||||
'devices_down': [],
|
||||
'failed_devices_up': [],
|
||||
'failed_devices_down': []})
|
||||
m_unbound = mock.patch.object(self.agent, 'port_unbound')
|
||||
|
||||
with m_delete as delete, m_rpc, m_unbound:
|
||||
self.agent.treat_devices_removed([port_id])
|
||||
delete.assert_called_with(mock.ANY, {'port_id': port_id})
|
||||
|
||||
def test_bind_port_with_missing_network(self):
|
||||
vif_port = mock.Mock()
|
||||
vif_port.name.return_value = 'port'
|
||||
|
|
Loading…
Reference in New Issue