#NEWLINE# def _get_floating_ip_info( self , context , host = None ) : #NEWLINE# #INDENT# floating_ip_info = { #NEWLINE# #INDENT# 'floating_ip_info' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# nova_context . require_admin_context ( context ) #NEWLINE# if ( host is None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# floating_ips = objects . FloatingIPList . get_all ( context ) #NEWLINE# #UNINDENT# except exception . NoFloatingIpsDefined : #NEWLINE# #INDENT# return floating_ip_info #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# floating_ips = objects . FloatingIPList . get_by_host ( context , host ) #NEWLINE# #UNINDENT# except exception . FloatingIpNotFoundForHost as e : #NEWLINE# #INDENT# raise webob . exc . HTTPNotFound ( explanation = e . format_message ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# for floating_ip in floating_ips : #NEWLINE# #INDENT# instance_uuid = None #NEWLINE# fixed_ip = None #NEWLINE# if floating_ip . fixed_ip : #NEWLINE# #INDENT# instance_uuid = floating_ip . fixed_ip . instance_uuid #NEWLINE# fixed_ip = str ( floating_ip . fixed_ip . address ) #NEWLINE# #UNINDENT# result = { #NEWLINE# #INDENT# 'address' : str ( floating_ip . address ) , #NEWLINE# 'pool' : floating_ip . pool , #NEWLINE# 'interface' : floating_ip . interface , #NEWLINE# 'project_id' : floating_ip . project_id , #NEWLINE# 'instance_uuid' : instance_uuid , #NEWLINE# 'fixed_ip' : floating_ips , #NEWLINE# #UNINDENT# } #NEWLINE# floating_ip_info [ 'floating_ip_info' ] . append ( result ) #NEWLINE# #UNINDENT# return floating_ip_info