def _populate_port_ha_information(self, context, port, router_id, hags,
                                      user_router_id, modified_interfaces):
        subnet_id = port['fixed_ips'][0]['subnet_id']
        try:
            hag = hags[subnet_id]
        except __HOLE__:
            # Oops, the subnet_id was not found. Probably because the DB
            # insertion of that HA group is still in progress by another
            # process and has not been committed to the DB yet.
            # Let's retry a few times to see if the DB entry turns up.
            LOG.debug('No HA group info for router: %(r_id)s and subnet: '
                      '%(s_id)s was found when populating HA info for port: '
                      '%(p_id)s. Will now make additional lookup attempts.',
                      {'r_id': router_id, 's_id': subnet_id,
                       'p_id': port['id']})
            try:
                hag = self._get_ha_group_for_subnet_id(context, router_id,
                                                       subnet_id)
            except exc.NoResultFound:
                hag = None
        if hag is None:
            LOG.debug('Failed to fetch the HA group info for for router: '
                      '%(r_id)s and subnet: %(s_id)s. Giving up. No HA '
                      'info will be added to the router\'s port: %s.',
                      {'r_id': router_id, 's_id': subnet_id,
                       'p_id': port['id']})
            # we leave it to the L3 config agent to handle this
            return
        else:
            LOG.debug('Successfully fetched the HA group info for '
                      'router: %(r_id)s and subnet: %(s_id)s from DB',
                      {'r_id': router_id, 's_id': subnet_id})
            hags[subnet_id] = hag
        if router_id == user_router_id:
            # If the router interface need no dedicated IP address we just
            # set the HA (VIP) port to the port itself. The config agent
            # driver will know how to handle this "signal".
            p_id = hag.extra_port_id or port['id']
            try:
                interface_port = self._core_plugin.get_port(context, p_id)
            except n_exc.PortNotFound:
                LOG.debug('**** NO Port Info for '
                    'router: %(r_id)s : Port: %(p_id)s from DB',
                    {'r_id': router_id, 'p_id': port['id']})
                return
            LOG.debug('**** Fetched Port Info for '
                'router: %(r_id)s : Port: %(p_id)s from DB',
                {'r_id': router_id, 'p_id': port['id']})
            self._populate_mtu_and_subnets_for_ports(context, [interface_port])
            modified_interfaces.append(interface_port)
            ha_port = port
        else:
            try:
                ha_port = self._core_plugin.get_port(context, hag.ha_port_id)
            except n_exc.PortNotFound:
                LOG.debug('**** NO Port Info for '
                    'router(BAK): %(r_id)s : Port: %(p_id)s from DB',
                    {'r_id': router_id, 'p_id': hag.ha_port_id})
                return
            LOG.debug('**** Fetched Port Info for '
                'router(BAK): %(r_id)s : Port: %(p_id)s from DB',
                {'r_id': router_id, 'p_id': hag.ha_port_id})
            self._populate_mtu_and_subnets_for_ports(context, [ha_port])
            interface_port = port
        interface_port[ha.HA_INFO] = {
            ha.TYPE: hag.ha_type,
            HA_GROUP: hag.group_identity,
            'timers_config': hag.timers_config,
            'tracking_config': hag.tracking_config,
            'other_config': hag.other_config,
            HA_PORT: ha_port}
        return interface_port
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/cisco/db/l3/ha_db.py/HA_db_mixin._populate_port_ha_information