Exemplo n.º 1
0
 def delete_port(self, tenant_id, net_id, port_id):
     """
     Deletes a port on a specified Virtual Network,
     if the port contains a remote interface attachment,
     the remote interface should first be un-plugged and
     then the port can be deleted.
     """
     LOG.debug("delete_port() called\n")
     network = db.network_get(net_id)
     port = db.port_get(net_id, port_id)
     attachment_id = port[const.INTERFACEID]
     if not attachment_id:
         self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id])
         db.port_destroy(net_id, port_id)
         new_port_dict = cutil.make_port_dict(port_id, None, None, None)
         return new_port_dict
     else:
         raise exc.PortInUse(port_id=port_id, net_id=net_id, att_id=attachment_id)
Exemplo n.º 2
0
 def delete_port(self, net_id, port_id):
     """Delete a port"""
     try:
         port = db.port_destroy(net_id, port_id)
         LOG.debug("Deleted port %s" % port.uuid)
         port_dict = {}
         port_dict["port-id"] = str(port.uuid)
         return port_dict
     except Exception, exc:
         raise Exception("Failed to delete port: %s" % str(exc))
Exemplo n.º 3
0
 def delete_port(self, net_id, port_id):
     """Delete a port."""
     try:
         port = db.port_destroy(net_id, port_id)
         LOG.debug("Deleted port %s" % port.uuid)
         port_dict = {}
         port_dict["port-id"] = str(port.uuid)
         return port_dict
     except Exception as exc:
         raise Exception("Failed to delete port: %s" % str(exc))
Exemplo n.º 4
0
 def delete_port(self, tenant_id, net_id, port_id):
     """
     Deletes a port on a specified Virtual Network,
     if the port contains a remote interface attachment,
     the remote interface should first be un-plugged and
     then the port can be deleted.
     """
     LOG.debug("delete_port() called\n")
     network = db.network_get(net_id)
     port = db.port_get(net_id, port_id)
     attachment_id = port[const.INTERFACEID]
     if not attachment_id:
         self._invoke_device_plugins(self._func_name(), [tenant_id,
                                                         net_id,
                                                         port_id])
         db.port_destroy(net_id, port_id)
         new_port_dict = cutil.make_port_dict(port_id, None, None, None)
         return new_port_dict
     else:
         raise exc.PortInUse(port_id=port_id, net_id=net_id,
                             att_id=attachment_id)