#NEWLINE# def _get_neutron_usage( self , limits , resource_name ) : #NEWLINE# #INDENT# resource_map = { #NEWLINE# #INDENT# 'floatingip' : { #NEWLINE# #INDENT# 'api' : api . network . tenant_floating_ip_list , #NEWLINE# 'limit_name' : 'totalFloatingIpsUsed' , #NEWLINE# 'message' : _ ( 'Unable to retrieve floating IP addresses.' ) , #NEWLINE# #UNINDENT# } , #NEWLINE# 'security_group' : { #NEWLINE# #INDENT# 'api' : api . network . security_group_list , #NEWLINE# 'limit_name' : 'totalSecurityGroupsUsed' , #NEWLINE# 'message' : _ ( 'Unable to retrieve security groups.' ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# resource = resource_map [ resource_name ] #NEWLINE# try : #NEWLINE# #INDENT# method = resource [ 'api' ] #NEWLINE# current_used = len ( method ( self . request ) ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# current_used = 0 #NEWLINE# msg = resource [ 'message' ] #NEWLINE# exceptions . handle ( self . request , resource ) #NEWLINE# #UNINDENT# limits [ resource [ 'limit_name' ] ] = current_used