Merge "Fix DVR regression for ofagent"

This commit is contained in:
Jenkins 2014-07-18 22:09:00 +00:00 committed by Gerrit Code Review
commit 67dd4dbf71
2 changed files with 12 additions and 8 deletions

View File

@ -939,6 +939,10 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
return self._bind_port_if_needed(port_context)
def update_port_status(self, context, port_id, status, host=None):
"""
Returns port_id (non-truncated uuid) if the port exists.
Otherwise returns None.
"""
updated = False
session = context.session
# REVISIT: Serialize this operation with a semaphore to
@ -951,7 +955,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
if not port:
LOG.warning(_("Port %(port)s updated up by agent not found"),
{'port': port_id})
return False
return None
if port.status != status:
original_port = self._make_port_dict(port)
port.status = status
@ -967,7 +971,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
if updated:
self.mechanism_manager.update_port_postcommit(mech_context)
return True
return port['id']
def port_bound_to_host(self, context, port_id, host):
port_host = db.get_port_binding_host(port_id)

View File

@ -159,9 +159,9 @@ class RpcCallbacks(n_rpc.RpcCallback,
return {'device': device,
'exists': port_exists}
port_exists = plugin.update_port_status(rpc_context, port_id,
q_const.PORT_STATUS_DOWN,
host)
port_exists = bool(plugin.update_port_status(rpc_context, port_id,
q_const.PORT_STATUS_DOWN,
host))
return {'device': device,
'exists': port_exists}
@ -182,9 +182,9 @@ class RpcCallbacks(n_rpc.RpcCallback,
{'device': device, 'host': host})
return
plugin.update_port_status(rpc_context, port_id,
q_const.PORT_STATUS_ACTIVE,
host)
port_id = plugin.update_port_status(rpc_context, port_id,
q_const.PORT_STATUS_ACTIVE,
host)
l3plugin = manager.NeutronManager.get_service_plugins().get(
service_constants.L3_ROUTER_NAT)
if l3plugin: