#NEWLINE# @ log_helper . log_method_call #NEWLINE# def _get_dvr_sync_data( self , context , host , agent , router_ids = None , active = None ) : #NEWLINE# #INDENT# ( routers , interfaces , floating_ips ) = self . _get_router_info_list ( context , router_ids = router_ids , active = active , device_owners = const . ROUTER_INTERFACE_OWNERS ) #NEWLINE# dvr_router_ids = set ( ( router [ 'id' ] for router in routers if is_distributed_router ( router ) ) ) #NEWLINE# floating_ip_port_ids = [ fip [ 'port_id' ] for fip in floating_ips if ( fip [ 'router_id' ] in dvr_router_ids ) ] #NEWLINE# if floating_ip_port_ids : #NEWLINE# #INDENT# port_filter = { #NEWLINE# #INDENT# 'id' : floating_ip_port_ids , #NEWLINE# #UNINDENT# } #NEWLINE# ports = self . _core_plugin . get_ports ( context , port_filter ) #NEWLINE# port_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for port in ports : #NEWLINE# #INDENT# port_profile = port . get ( portbindings . PROFILE ) #NEWLINE# port_in_migration = ( active and ( port_profile . get ( 'migrating_to' ) == host ) ) #NEWLINE# if ( ( port [ portbindings . HOST_ID ] == host ) or port_in_migration ) : #NEWLINE# #INDENT# port_dict . update ( { #NEWLINE# #INDENT# port [ 'id' ] : port , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# for fip in floating_ips : #NEWLINE# #INDENT# vm_port = port_dict . get ( fip [ 'port_id' ] , None ) #NEWLINE# if vm_port : #NEWLINE# #INDENT# fip [ 'host' ] = self . _get_dvr_service_port_hostid ( context , fip [ 'port_id' ] , port = vm_port ) #NEWLINE# fip [ 'dest_host' ] = self . _get_dvr_migrating_service_port_hostid ( context , fip [ 'port_id' ] , port = vm_port ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# routers_dict = self . _process_routers ( context , routers ) #NEWLINE# self . _process_floating_ips_dvr ( context , routers_dict , floating_ips , host , agent ) #NEWLINE# ports_to_populate = [ ] #NEWLINE# for router in routers_dict . values ( ) : #NEWLINE# #INDENT# if router . get ( 'gw_port' ) : #NEWLINE# #INDENT# ports_to_populate . append ( router [ 'gw_port' ] ) #NEWLINE# #UNINDENT# if router . get ( l3_const . FLOATINGIP_AGENT_INTF_KEY ) : #NEWLINE# #INDENT# ports_to_populate += router [ l3_const . FLOATINGIP_AGENT_INTF_KEY ] #NEWLINE# #UNINDENT# if router . get ( l3_const . SNAT_ROUTER_INTF_KEY ) : #NEWLINE# #INDENT# ports_to_populate += router [ l3_const . SNAT_ROUTER_INTF_KEY ] #NEWLINE# #UNINDENT# #UNINDENT# ports_to_populate += interfaces #NEWLINE# self . _populate_mtu_and_subnets_for_ports ( context , ports_to_populate ) #NEWLINE# self . _process_interfaces ( routers_dict , interfaces ) #NEWLINE# return list ( routers_dict . values ( ) )