Merge "Fix OVS agent reclaims local VLAN"

This commit is contained in:
Jenkins 2013-11-22 09:55:46 +00:00 committed by Gerrit Code Review
commit 468a0ab162
2 changed files with 6 additions and 11 deletions

View File

@ -978,21 +978,16 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
for device in devices: for device in devices:
LOG.info(_("Attachment %s removed"), device) LOG.info(_("Attachment %s removed"), device)
try: try:
details = self.plugin_rpc.update_device_down(self.context, self.plugin_rpc.update_device_down(self.context,
device, device,
self.agent_id, self.agent_id,
cfg.CONF.host) cfg.CONF.host)
except Exception as e: except Exception as e:
LOG.debug(_("port_removed failed for %(device)s: %(e)s"), LOG.debug(_("port_removed failed for %(device)s: %(e)s"),
{'device': device, 'e': e}) {'device': device, 'e': e})
resync = True resync = True
continue continue
if details['exists']: self.port_unbound(device)
LOG.info(_("Port %s updated."), device)
# Nothing to do regarding local networking
else:
LOG.debug(_("Device %s not defined on plugin"), device)
self.port_unbound(device)
return resync return resync
def treat_ancillary_devices_removed(self, devices): def treat_ancillary_devices_removed(self, devices):

View File

@ -222,7 +222,7 @@ class TestOvsNeutronAgent(base.BaseTestCase):
return_value=details): return_value=details):
with mock.patch.object(self.agent, 'port_unbound') as port_unbound: with mock.patch.object(self.agent, 'port_unbound') as port_unbound:
self.assertFalse(self.agent.treat_devices_removed([{}])) self.assertFalse(self.agent.treat_devices_removed([{}]))
self.assertEqual(port_unbound.called, not port_exists) self.assertTrue(port_unbound.called)
def test_treat_devices_removed_unbinds_port(self): def test_treat_devices_removed_unbinds_port(self):
self._mock_treat_devices_removed(True) self._mock_treat_devices_removed(True)