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
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
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)
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}
{'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: