#NEWLINE# def deallocate_for_instance( self , context , **kwargs ) : #NEWLINE# #INDENT# 'Handles deallocating floating IP resources for an instance.\n\n        calls super class deallocate_for_instance() as well.\n\n        rpc.called by network_api\n        ' #NEWLINE# instance_id = kwargs . get ( 'instance_id' ) #NEWLINE# LOG . debug ( _ ( 'floating IP deallocation for instance |%s|' ) , instance_id , context = context ) #NEWLINE# fixed_ips = self . db . fixed_ip_get_by_instance ( context , instance_id ) #NEWLINE# kwargs [ 'fixed_ips' ] = fixed_ips #NEWLINE# for fixed_ip in fixed_ips : #NEWLINE# #INDENT# for floating_ip in fixed_ip . floating_ips : #NEWLINE# #INDENT# address = floating_ip [ 'address' ] #NEWLINE# self . network_api . disassociate_floating_ip ( fixed_ips , address , True ) #NEWLINE# if floating_ip [ 'auto_assigned' ] : #NEWLINE# #INDENT# self . network_api . release_floating_ip ( context , address , True ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# super ( FloatingIP , self ) . deallocate_for_instance ( context , ** kwargs )