diff --git a/neutron/db/l3_dvrscheduler_db.py b/neutron/db/l3_dvrscheduler_db.py index af9854d5be7..b8e3e234aaa 100644 --- a/neutron/db/l3_dvrscheduler_db.py +++ b/neutron/db/l3_dvrscheduler_db.py @@ -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) diff --git a/neutron/db/l3_hascheduler_db.py b/neutron/db/l3_hascheduler_db.py index 85524a039aa..8da57db8654 100644 --- a/neutron/db/l3_hascheduler_db.py +++ b/neutron/db/l3_hascheduler_db.py @@ -59,7 +59,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', '')