def update_port(self, context, id, port): params = {} port_quantum = super(NvpPluginV2, self).get_port(context, id) port_nvp, cluster = ( nvplib.get_port_by_quantum_tag(self.clusters.itervalues(), port_quantum["network_id"], id)) params["cluster"] = cluster params["port"] = port_quantum LOG.debug(_("Update port request: %s"), params) nvplib.update_port(port_quantum['network_id'], port_nvp['uuid'], **params) return super(NvpPluginV2, self).update_port(context, id, port)
def update_port(self, context, id, port): self._enforce_set_auth(context, port, self.port_security_enabled_update) tenant_id = self._get_tenant_id_for_create(context, port) with context.session.begin(subtransactions=True): ret_port = super(NvpPluginV2, self).update_port( context, id, port) # copy values over ret_port.update(port['port']) # Handle port security if psec.PORTSECURITY in port['port']: self._update_port_security_binding( context, id, ret_port[psec.PORTSECURITY]) # populate with value else: ret_port[psec.PORTSECURITY] = self._get_port_security_binding( context, id) port_nvp, cluster = ( nvplib.get_port_by_quantum_tag(self.clusters.itervalues(), ret_port["network_id"], id)) LOG.debug(_("Update port request: %s"), port) nvplib.update_port(cluster, ret_port['network_id'], port_nvp['uuid'], id, tenant_id, ret_port['name'], ret_port['device_id'], ret_port['admin_state_up'], ret_port['mac_address'], ret_port['fixed_ips'], ret_port[psec.PORTSECURITY]) # Update the port status from nvp. If we fail here hide it since # the port was successfully updated but we were not able to retrieve # the status. try: ret_port['status'] = nvplib.get_port_status( cluster, ret_port['network_id'], port_nvp['uuid']) except: LOG.warn(_("Unable to retrieve port status for: %s."), port_nvp['uuid']) return ret_port