def _safe_client_delete_network(safe_reference, net_id):
     # Avoid handing naked plugin references to the client.  When
     # the client is mocked for testing, such references can
     # prevent the plugin from being deallocated.
     client.ignore_http_not_found(
         lambda: safe_reference.client.delete_network(net_id))
     client.ignore_http_not_found(
         lambda: safe_reference.tun_client.delete_tunnel_key(net_id))
Example #2
0
 def _safe_client_delete_network(safe_reference, net_id):
     # Avoid handing naked plugin references to the client.  When
     # the client is mocked for testing, such references can
     # prevent the plugin from being deallocated.
     client.ignore_http_not_found(
         lambda: safe_reference.client.delete_network(net_id))
     client.ignore_http_not_found(
         lambda: safe_reference.tun_client.delete_tunnel_key(net_id))
Example #3
0
    def delete_port(self, context, id, l3_port_check=True):
        with context.session.begin(subtransactions=True):
            port = self._get_port(context, id)
            net_id = port.network_id
            try:
                port_binding = db_api_v2.port_binding_destroy(
                    context.session, port.id, net_id)
                datapath_id = port_binding.dpid
                port_no = port_binding.port_no
                ignore_http_not_found(lambda: self.client.delete_port(
                    net_id, datapath_id, port_no))
            except q_exc.PortNotFound:
                pass

        # if needed, check to see if this is a port owned by
        # and l3-router. If so, we should prevent deletion.
        if l3_port_check:
            self.prevent_l3_port_deletion(context, id)
        self.disassociate_floatingips(context, id)
        return super(RyuQuantumPluginV2, self).delete_port(context, id)
    def delete_port(self, context, id, l3_port_check=True):
        with context.session.begin(subtransactions=True):
            port = self._get_port(context, id)
            net_id = port.network_id
            try:
                port_binding = db_api_v2.port_binding_destroy(context.session,
                                                              port.id, net_id)
                datapath_id = port_binding.dpid
                port_no = port_binding.port_no
                ignore_http_not_found(
                    lambda: self.client.delete_port(net_id, datapath_id,
                                                    port_no))
            except q_exc.PortNotFound:
                pass

        # if needed, check to see if this is a port owned by
        # and l3-router. If so, we should prevent deletion.
        if l3_port_check:
            self.prevent_l3_port_deletion(context, id)
        self.disassociate_floatingips(context, id)
        return super(RyuQuantumPluginV2, self).delete_port(context, id)
 def _client_delete_network(self, net_id):
     client.ignore_http_not_found(
         lambda: self.client.delete_network(net_id))
     client.ignore_http_not_found(
         lambda: self.tun_client.delete_tunnel_key(net_id))
Example #6
0
 def _client_delete_network(self, net_id):
     client.ignore_http_not_found(
         lambda: self.client.delete_network(net_id))
     client.ignore_http_not_found(
         lambda: self.tun_client.delete_tunnel_key(net_id))