def delete_l2_gateway_connection(self, context, gw_connection): """Delete a L2 gateway connection.""" conn_mapping = nsx_db.get_l2gw_connection_mapping( session=context.session, connection_id=gw_connection) if not conn_mapping: LOG.error( "Unable to delete gateway connection %(id)s: mapping " "not found", {'id': gw_connection}) # Do not block the deletion return bridge_endpoint_id = conn_mapping.get('bridge_endpoint_id') # Delete the logical port from the bridge endpoint. self._core_plugin.delete_port(context=context, port_id=conn_mapping.get('port_id'), l2gw_port_check=False) try: self._core_plugin.nsxlib.bridge_endpoint.delete(bridge_endpoint_id) except nsxlib_exc.ManagerError as e: LOG.exception( "Unable to delete bridge endpoint %(id)s on the " "backend due to exc: %(exc)s", { 'id': bridge_endpoint_id, 'exc': e }) raise l2gw_exc.L2GatewayServiceDriverError( method='delete_l2_gateway_connection')
def delete_l2_gateway_connection(self, context, l2_gateway_connection): """Delete a L2 gateway connection.""" conn_mapping = nsx_db.get_l2gw_connection_mapping( session=context.session, connection_id=l2_gateway_connection) bridge_endpoint_id = conn_mapping.get('bridge_endpoint_id') # Delete the logical port from the bridge endpoint. self._core_plugin.delete_port(context=context, port_id=conn_mapping.get('port_id'), l2gw_port_check=False) try: nsxlib.delete_bridge_endpoint(bridge_endpoint_id) except nsx_exc.ManagerError: LOG.exception(_LE("Unable to delete bridge endpoint %s on the " "backend.") % bridge_endpoint_id) return (super(NsxV3Driver, self). delete_l2_gateway_connection(context, l2_gateway_connection))
def delete_l2_gateway_connection_postcommit(self, context, gw_connection): """Delete a L2 gateway connection.""" conn_mapping = nsx_db.get_l2gw_connection_mapping( session=context.session, connection_id=gw_connection) bridge_endpoint_id = conn_mapping.get('bridge_endpoint_id') # Delete the logical port from the bridge endpoint. self._core_plugin.delete_port(context=context, port_id=conn_mapping.get('port_id'), l2gw_port_check=False) try: self._core_plugin.nsxlib.delete_bridge_endpoint(bridge_endpoint_id) except nsxlib_exc.ManagerError as e: LOG.exception( _LE("Unable to delete bridge endpoint %(id)s on the " "backend due to exc: %(exc)s"), { 'id': bridge_endpoint_id, 'exc': e }) raise l2gw_exc.L2GatewayServiceDriverError( method='delete_l2_gateway_connection_postcommit')
def delete_l2_gateway_connection(self, context, gw_connection): """Delete a L2 gateway connection.""" conn_mapping = nsx_db.get_l2gw_connection_mapping( session=context.session, connection_id=gw_connection) if not conn_mapping: LOG.error("Unable to delete gateway connection %(id)s: mapping " "not found", {'id': gw_connection}) # Do not block the deletion return bridge_endpoint_id = conn_mapping.get('bridge_endpoint_id') # Delete the logical port from the bridge endpoint. self._core_plugin.delete_port(context=context, port_id=conn_mapping.get('port_id'), l2gw_port_check=False) try: self._core_plugin.nsxlib.bridge_endpoint.delete(bridge_endpoint_id) except nsxlib_exc.ManagerError as e: LOG.exception("Unable to delete bridge endpoint %(id)s on the " "backend due to exc: %(exc)s", {'id': bridge_endpoint_id, 'exc': e}) raise l2gw_exc.L2GatewayServiceDriverError( method='delete_l2_gateway_connection')