Skip to content

Commit

Permalink
Call ext_manager.delete_port on port removal
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ivc committed May 23, 2016
1 parent 73a06b9 commit bc47fe9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,7 @@ def treat_devices_removed(self, devices):
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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,21 @@ def test_treat_devices_removed_failed_devices(self):
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'
Expand Down

0 comments on commit bc47fe9

Please sign in to comment.