#NEWLINE# @ utils . synchronized ( 'setup_network' , external = True ) #NEWLINE# def _teardown_network_on_host( self , context , network ) : #NEWLINE# #INDENT# if ( not CONF . fake_network ) : #NEWLINE# #INDENT# network [ 'dhcp_server' ] = self . _get_dhcp_ip ( network , network ) #NEWLINE# dev = self . driver . get_dev ( network ) #NEWLINE# vpn_address = network [ 'vpn_public_address' ] #NEWLINE# if ( CONF . teardown_unused_network_gateway and network [ 'multi_host' ] and ( vpn_address != CONF . vpn_ip ) and ( not objects . Network . in_use_on_host ( context , network [ 'id' ] , self . host ) ) ) : #NEWLINE# #INDENT# LOG . debug ( 'Remove unused gateway %s' , network [ 'bridge' ] ) #NEWLINE# if network . enable_dhcp : #NEWLINE# #INDENT# self . driver . kill_dhcp ( dev ) #NEWLINE# #UNINDENT# self . l3driver . remove_gateway ( network ) #NEWLINE# if ( not self . _uses_shared_ip ( network ) ) : #NEWLINE# #INDENT# fip = objects . FixedIP . get_by_address ( context , network . dhcp_server ) #NEWLINE# fip . allocated = False #NEWLINE# fip . host = None #NEWLINE# fip . save ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if network . enable_dhcp : #NEWLINE# #INDENT# elevated = context . elevated ( ) #NEWLINE# self . driver . update_dhcp ( elevated , dev , network )