#NEWLINE# def allocate_fixed_ip( self , context , instance_id , network , **kwargs ) : #NEWLINE# #INDENT# 'Gets a fixed ip from the pool.' #NEWLINE# address = None #NEWLINE# if network [ 'cidr' ] : #NEWLINE# #INDENT# address = kwargs . get ( 'address' , None ) #NEWLINE# if address : #NEWLINE# #INDENT# address = self . db . fixed_ip_associate ( context , address , instance_id , network [ 'id' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# address = self . db . fixed_ip_associate_pool ( context . elevated ( ) , network [ 'id' ] , instance_id ) #NEWLINE# #UNINDENT# self . _do_trigger_security_group_members_refresh_for_instance ( instance_id ) #NEWLINE# get_vif = self . db . virtual_interface_get_by_instance_and_network #NEWLINE# vif = get_vif ( context , instance_id , network [ 'id' ] ) #NEWLINE# values = { #NEWLINE# #INDENT# 'allocated' : True , #NEWLINE# 'virtual_interface_id' : vif [ 'id' ] , #NEWLINE# #UNINDENT# } #NEWLINE# self . db . fixed_ip_update ( context , address , values ) #NEWLINE# #UNINDENT# self . _setup_network ( context , network ) #NEWLINE# return address