#NEWLINE# def _create_redundancy_routers( self , context , new_router , ha_settings , new_router_db , ports = None , expire_db = False ) : #NEWLINE# #INDENT# 'To be called in create_router() AFTER router has been\n        created in DB.\n        ' #NEWLINE# if ( ( ha . ENABLED not in ha_settings ) or ( not ha_settings [ ha . ENABLED ] ) ) : #NEWLINE# #INDENT# new_router [ ha . HA ] = { #NEWLINE# #INDENT# ha . ENABLED : False , #NEWLINE# #UNINDENT# } #NEWLINE# return #NEWLINE# #UNINDENT# ha_spec = ha_settings [ ha . DETAILS ] #NEWLINE# priority = ha_spec . get ( ha . PRIORITY , DEFAULT_MASTER_PRIORITY ) #NEWLINE# with context . session . begin ( subtransactions = True ) : #NEWLINE# #INDENT# r_ha_s_db = RouterHASetting ( router_id = self [ 'id' ] , ha_type = ha_spec [ ha . TYPE ] , redundancy_level = ha_spec [ ha . REDUNDANCY_LEVEL ] , priority = priority , probe_connectivity = ha_spec [ ha . PROBE_CONNECTIVITY ] , probe_target = ha_spec [ ha . PROBE_TARGET ] , probe_interval = ha_spec [ ha . PROBE_INTERVAL ] ) #NEWLINE# context . session . add ( r_ha_s_db ) #NEWLINE# #UNINDENT# if ( r_ha_s_db . probe_connectivity and ( r_ha_s_db . probe_target is None ) ) : #NEWLINE# #INDENT# LOG . warning ( _LW ( "Connectivity probing for high-availability is enabled but probe target is not specified. Please configure option 'default_probe_target'." ) ) #NEWLINE# #UNINDENT# e_context = context . elevated ( ) #NEWLINE# if new_router_db . gw_port : #NEWLINE# #INDENT# gw_port = self . _core_plugin . _make_port_dict ( new_router_db . gw_port ) #NEWLINE# self . _create_ha_group ( e_context , new_router , gw_port , r_ha_s_db ) #NEWLINE# #UNINDENT# self . _add_redundancy_routers ( e_context , 1 , ( ha_spec [ ha . REDUNDANCY_LEVEL ] + 1 ) , new_router , ( ports or [ ] ) , r_ha_s_db ) #NEWLINE# if expire_db : #NEWLINE# #INDENT# context . session . expire ( new_router_db ) #NEWLINE# #UNINDENT# self . _extend_router_dict_ha ( new_router , new_router_db )