Merge "Check for unbound ports in L3 RPC handler"
This commit is contained in:
commit
d51ac22dd3
@ -134,12 +134,13 @@ class L3RpcCallback(object):
|
||||
|
||||
def _ensure_host_set_on_port(self, context, host, port, router_id=None,
|
||||
ha_router_port=False):
|
||||
not_bound = port and port.get(portbindings.VIF_TYPE) in (
|
||||
portbindings.VIF_TYPE_BINDING_FAILED,
|
||||
portbindings.VIF_TYPE_UNBOUND)
|
||||
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
|
||||
port.get(portbindings.VIF_TYPE) ==
|
||||
portbindings.VIF_TYPE_BINDING_FAILED)):
|
||||
port.get(portbindings.HOST_ID) != host or not_bound)):
|
||||
|
||||
# Ports owned by non-HA routers are bound again if they're
|
||||
# already bound but the router moved to another host.
|
||||
|
@ -3693,6 +3693,14 @@ class L3RpcCallbackTestCase(base.BaseTestCase):
|
||||
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_bad_bindings(self):
|
||||
for b in (portbindings.VIF_TYPE_BINDING_FAILED,
|
||||
portbindings.VIF_TYPE_UNBOUND):
|
||||
port = {'id': 'id', portbindings.HOST_ID: 'somehost',
|
||||
portbindings.VIF_TYPE: b}
|
||||
self.l3_rpc_cb._ensure_host_set_on_port(None, 'somehost', port)
|
||||
self.assertTrue(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 = {
|
||||
|
Loading…
Reference in New Issue
Block a user