Beispiel #1
0
 def auto_schedule_routers(self, context, host, router_ids):
     router_ids = rdb.get_routers_by_provider(
         context.session, nconst.ROUTER_PROVIDER_L3AGENT, router_ids)
     # If no l3-agent hosted router, there is no need to schedule.
     if not router_ids:
         return
     return super(L3AgentSchedulerDbMixin, self).auto_schedule_routers(
         context, host, router_ids)
Beispiel #2
0
    def _notification(self, context, method, router_ids, operation, data):
        """Notify all the agents that are hosting the routers.

        _notification() is called in L3 db plugin for all routers regardless
        the routers are hosted on l3 agents or not. When the routers are
        not hosted on l3 agents, there is no need to notify.
        This method filters routers not hosted by l3 agents.
        """
        router_ids = rdb.get_routers_by_provider(context.session, nconst.ROUTER_PROVIDER_L3AGENT, router_ids)
        super(L3AgentNotifyAPI, self)._notification(context, method, router_ids, operation, data)
Beispiel #3
0
    def _get_sync_routers(self, context, router_ids=None, active=None):
        """Query routers and their gw ports for l3 agent.

        The difference from the superclass in l3_db is that this method
        only lists routers hosted on l3-agents.
        """
        router_list = super(RouterMixin, self)._get_sync_routers(context, router_ids, active)
        if router_list:
            _router_ids = [r["id"] for r in router_list]
            agent_routers = rdb.get_routers_by_provider(context.session, "l3-agent", router_ids=_router_ids)
            router_list = [r for r in router_list if r["id"] in agent_routers]
        return router_list
Beispiel #4
0
    def _notification(self, context, method, router_ids, operation,
                      shuffle_agents):
        """Notify all the agents that are hosting the routers.

        _notification() is called in L3 db plugin for all routers regardless
        the routers are hosted on l3 agents or not. When the routers are
        not hosted on l3 agents, there is no need to notify.
        This method filters routers not hosted by l3 agents.
        """
        router_ids = rdb.get_routers_by_provider(
            context.session, nconst.ROUTER_PROVIDER_L3AGENT, router_ids)
        super(L3AgentNotifyAPI,
              self)._notification(context, method, router_ids, operation,
                                  shuffle_agents)
Beispiel #5
0
    def _get_sync_routers(self, context, router_ids=None, active=None):
        """Query routers and their gw ports for l3 agent.

        The difference from the superclass in l3_db is that this method
        only lists routers hosted on l3-agents.
        """
        router_list = super(RouterMixin,
                            self)._get_sync_routers(context, router_ids,
                                                    active)
        if router_list:
            _router_ids = [r['id'] for r in router_list]
            agent_routers = rdb.get_routers_by_provider(context.session,
                                                        'l3-agent',
                                                        router_ids=_router_ids)
            router_list = [r for r in router_list if r['id'] in agent_routers]
        return router_list