#NEWLINE# def get_instance_uuids_by_ip_filter( self , context , filters ) : #NEWLINE# #INDENT# fixed_ip_filter = filters . get ( 'fixed_ip' ) #NEWLINE# ip_filter = re . compile ( str ( filters . get ( 'ip' ) ) ) #NEWLINE# ipv6_filter = re . compile ( str ( filters . get ( 'ip6' ) ) ) #NEWLINE# LOG . debug ( 'Get instance uuids by IP filters. Fixed IP filter: %s. IP filter: %s. IPv6 filter: %s' , fixed_ip_filter , str ( filters . get ( 'ip' ) ) , str ( filters . get ( 'ip6' ) ) ) #NEWLINE# vifs = objects . VirtualInterfaceList . get_all ( context ) #NEWLINE# results = [ ] #NEWLINE# for vif in vifs : #NEWLINE# #INDENT# if ( vif . instance_uuid is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# network = self . _get_network_by_id ( context , vif . network_id ) #NEWLINE# fixed_ipv6 = None #NEWLINE# if ( network [ 'cidr_v6' ] is not None ) : #NEWLINE# #INDENT# fixed_ipv6 = ipv6 . to_global ( network [ 'cidr_v6' ] , vif . address , context . project_id ) #NEWLINE# #UNINDENT# if ( fixed_ipv6 and ipv6_filter . match ( fixed_ipv6 ) ) : #NEWLINE# #INDENT# results . append ( { #NEWLINE# #INDENT# 'instance_uuid' : vif . instance_uuid , #NEWLINE# 'ip' : fixed_ipv6 , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# fixed_ips = objects . FixedIPList . get_by_virtual_interface_id ( context , vif . id ) #NEWLINE# for fixed_ip in fixed_ips : #NEWLINE# #INDENT# if ( ( not fixed_ip ) or ( not fixed_ip . address ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( str ( fixed_ip . address ) == fixed_ip_filter ) : #NEWLINE# #INDENT# results . append ( { #NEWLINE# #INDENT# 'instance_uuid' : vif . instance_uuid , #NEWLINE# 'ip' : fixed_ip . address , #NEWLINE# #UNINDENT# } ) #NEWLINE# continue #NEWLINE# #UNINDENT# if ip_filter . match ( str ( fixed_ip . address ) ) : #NEWLINE# #INDENT# results . append ( { #NEWLINE# #INDENT# 'instance_uuid' : vif . instance_uuid , #NEWLINE# 'ip' : fixed_ip . address , #NEWLINE# #UNINDENT# } ) #NEWLINE# continue #NEWLINE# #UNINDENT# for floating_ip in fixed_ip . floating_ips : #NEWLINE# #INDENT# if ( ( not floating_ip ) or ( not floating_ip . address ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ip_filter . match ( str ( floating_ip . address ) ) : #NEWLINE# #INDENT# results . append ( { #NEWLINE# #INDENT# 'instance_uuid' : vif . instance_uuid , #NEWLINE# 'ip' : floating_ip . address , #NEWLINE# #UNINDENT# } ) #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return results