#NEWLINE# @ wsgi . response ( 202 ) #NEWLINE# @ extensions . expected_errors ( ( 400 , 403 , 404 , 409 ) ) #NEWLINE# def delete( self , req , id ) : #NEWLINE# #INDENT# context = address . environ [ 'nova.context' ] #NEWLINE# authorize ( context ) #NEWLINE# try : #NEWLINE# #INDENT# floating_ip = self . network_api . get_floating_ip ( context , id ) #NEWLINE# #UNINDENT# except ( exception . NotFound , exception . FloatingIpNotFound ) : #NEWLINE# #INDENT# msg = ( _ ( 'Floating IP not found for ID %s' ) % id ) #NEWLINE# raise webob . exc . HTTPNotFound ( explanation = msg ) #NEWLINE# #UNINDENT# except exception . InvalidID as e : #NEWLINE# #INDENT# raise webob . exc . HTTPBadRequest ( explanation = e . format_message ( ) ) #NEWLINE# #UNINDENT# address = floating_ip [ 'address' ] #NEWLINE# instance = get_instance_by_floating_ip_addr ( self , context , address ) #NEWLINE# try : #NEWLINE# #INDENT# self . network_api . disassociate_and_release_floating_ip ( context , instance , floating_ip ) #NEWLINE# #UNINDENT# except exception . Forbidden : #NEWLINE# #INDENT# raise webob . exc . HTTPForbidden ( ) #NEWLINE# #UNINDENT# except exception . CannotDisassociateAutoAssignedFloatingIP : #NEWLINE# #INDENT# msg = _ ( 'Cannot disassociate auto assigned floating IP' ) #NEWLINE# raise webob . exc . HTTPForbidden ( explanation = msg )