#NEWLINE# def delete_port( self , context , id , l3_port_check = True ) : #NEWLINE# #INDENT# self . _pre_delete_port ( context , id , l3_port_check ) #NEWLINE# router_ids = [ ] #NEWLINE# l3plugin = manager . NeutronManager . get_service_plugins ( ) . get ( service_constants . L3_ROUTER_NAT ) #NEWLINE# session = context . session #NEWLINE# with session . begin ( subtransactions = True ) : #NEWLINE# #INDENT# ( port_db , binding ) = db . get_locked_port_and_binding ( session , id ) #NEWLINE# if ( not port_db ) : #NEWLINE# #INDENT# LOG . debug ( "The port '%s' was deleted" , id ) #NEWLINE# return #NEWLINE# #UNINDENT# port = self . _make_port_dict ( port_db ) #NEWLINE# network = self . get_network ( context , port [ 'network_id' ] ) #NEWLINE# bound_mech_contexts = [ ] #NEWLINE# device_owner = port [ 'device_owner' ] #NEWLINE# if ( device_owner == const . DEVICE_OWNER_DVR_INTERFACE ) : #NEWLINE# #INDENT# bindings = db . get_dvr_port_bindings ( context . session , id ) #NEWLINE# for bind in bindings : #NEWLINE# #INDENT# levels = db . get_binding_levels ( context . session , id , bind . host ) #NEWLINE# mech_context = driver_context . PortContext ( self , context , port , network , bind , levels ) #NEWLINE# self . mechanism_manager . delete_port_precommit ( mech_context ) #NEWLINE# bound_mech_contexts . append ( mech_context ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# levels = db . get_binding_levels ( context . session , id , binding . host ) #NEWLINE# mech_context = driver_context . PortContext ( self , context , port , network , binding , levels ) #NEWLINE# self . mechanism_manager . delete_port_precommit ( mech_context ) #NEWLINE# bound_mech_contexts . append ( mech_context ) #NEWLINE# #UNINDENT# if l3plugin : #NEWLINE# #INDENT# router_ids = l3plugin . disassociate_floatingips ( context , id , do_notify = False ) #NEWLINE# #UNINDENT# LOG . debug ( 'Calling delete_port for %(port_id)s owned by %(owner)s' , { #NEWLINE# #INDENT# 'port_id' : id , #NEWLINE# 'owner' : device_owner , #NEWLINE# #UNINDENT# } ) #NEWLINE# super ( Ml2Plugin , self ) . delete_port ( context , id ) #NEWLINE# #UNINDENT# self . _post_delete_port ( context , port , router_ids , bound_mech_contexts )