Fix _notify_l3_agent_port_update when there is no binding host
When _notify_l3_agent_port_update is called, there may be the case that portbindings.HOST_ID key is not in new_port or original_port dict. It is like that e.g. in some unit tests of api extensions. So lets use get() method to get it. The case when host_id is None is already handled properly in this method so that is fine to do. Change-Id: I490506cc6c9b18a3ca12e474f9ee9f8f3712ce7b
This commit is contained in:
parent
129c68ef39
commit
a27081636b
|
@ -549,14 +549,14 @@ def _notify_l3_agent_port_update(resource, event, trigger, **kwargs):
|
|||
if new_port and original_port:
|
||||
l3plugin = directory.get_plugin(plugin_constants.L3)
|
||||
context = kwargs['context']
|
||||
new_port_host = new_port.get(portbindings.HOST_ID)
|
||||
original_port_host = original_port.get(portbindings.HOST_ID)
|
||||
is_new_port_binding_changed = (
|
||||
new_port[portbindings.HOST_ID] and
|
||||
new_port[portbindings.HOST_ID] !=
|
||||
original_port[portbindings.HOST_ID])
|
||||
new_port_host and
|
||||
new_port_host != original_port_host)
|
||||
is_bound_port_moved = (
|
||||
original_port[portbindings.HOST_ID] and
|
||||
original_port[portbindings.HOST_ID] !=
|
||||
new_port[portbindings.HOST_ID])
|
||||
original_port_host and
|
||||
original_port_host != new_port_host)
|
||||
fip_router_id = None
|
||||
dest_host = None
|
||||
new_port_profile = new_port.get(portbindings.PROFILE)
|
||||
|
|
|
@ -58,7 +58,7 @@ def _notify_l3_agent_ha_port_update(resource, event, trigger, **kwargs):
|
|||
new_port = kwargs.get('port')
|
||||
original_port = kwargs.get('original_port')
|
||||
context = kwargs.get('context')
|
||||
host = new_port[portbindings.HOST_ID]
|
||||
host = new_port.get(portbindings.HOST_ID)
|
||||
|
||||
if new_port and original_port and host:
|
||||
new_device_owner = new_port.get('device_owner', '')
|
||||
|
|
Loading…
Reference in New Issue