def _create_redundancy_routers(self, context, new_router, ha_settings,<EOL>new_router_db, ports=None, expire_db=False):
if (ha.ENABLED not in ha_settings or<EOL>not ha_settings[ha.ENABLED]):<EOL><INDENT>new_router[ha.HA] = {ha.ENABLED: False}<EOL>return<EOL><DEDENT>ha_spec = ha_settings[ha.DETAILS]<EOL>priority = ha_spec.get(ha.PRIORITY, DEFAULT_MASTER_PRIORITY)<EOL>with context.session.begin(subtransactions=True):<EOL><INDENT>r_ha_s_db = RouterHASetting(<EOL>router_id=new_router['<STR_LIT:id>'],<EOL>ha_type=ha_spec[ha.TYPE],<EOL>redundancy_level=ha_spec[ha.REDUNDANCY_LEVEL],<EOL>priority=priority,<EOL>probe_connectivity=ha_spec[ha.PROBE_CONNECTIVITY],<EOL>probe_target=ha_spec[ha.PROBE_TARGET],<EOL>probe_interval=ha_spec[ha.PROBE_INTERVAL])<EOL>context.session.add(r_ha_s_db)<EOL><DEDENT>if r_ha_s_db.probe_connectivity and r_ha_s_db.probe_target is None:<EOL><INDENT>LOG.warning("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>e_context = context.elevated()<EOL>if new_router_db.gw_port:<EOL><INDENT>gw_port = self._core_plugin._make_port_dict(new_router_db.gw_port)<EOL>self._create_ha_group(e_context, new_router, gw_port, r_ha_s_db)<EOL><DEDENT>self._add_redundancy_routers(e_context, <NUM_LIT:1>,<EOL>ha_spec[ha.REDUNDANCY_LEVEL] + <NUM_LIT:1>,<EOL>new_router, ports or [], r_ha_s_db)<EOL>if expire_db:<EOL><INDENT>context.session.expire(new_router_db)<EOL><DEDENT>self._extend_router_dict_ha(new_router, new_router_db)<EOL>
To be called in create_router() AFTER router has been
        created in DB.