Merge "Don't update port with host id of None"

This commit is contained in:
Jenkins 2015-05-01 22:26:03 +00:00 committed by Gerrit Code Review
commit 22b542006a
2 changed files with 6 additions and 1 deletions

View File

@ -115,7 +115,7 @@ class L3RpcCallback(object):
router['id'])
def _ensure_host_set_on_port(self, context, host, port, router_id=None):
if (port and
if (port and host is not None and
(port.get('device_owner') !=
constants.DEVICE_OWNER_DVR_INTERFACE and
port.get(portbindings.HOST_ID) != host or

View File

@ -2570,6 +2570,11 @@ class L3RpcCallbackTestCase(base.BaseTestCase):
'l3plugin', new_callable=mock.PropertyMock).start()
self.l3_rpc_cb = l3_rpc.L3RpcCallback()
def test__ensure_host_set_on_port_host_id_none(self):
port = {'id': 'id', portbindings.HOST_ID: 'somehost'}
self.l3_rpc_cb._ensure_host_set_on_port(None, None, port)
self.assertFalse(self.l3_rpc_cb.plugin.update_port.called)
def test__ensure_host_set_on_port_update_on_concurrent_delete(self):
port_id = 'foo_port_id'
port = {