当前位置: 首页>>代码示例>>Python>>正文


Python agentschedulers_db.get_admin_state_up_filter函数代码示例

本文整理汇总了Python中neutron.db.agentschedulers_db.get_admin_state_up_filter函数的典型用法代码示例。如果您正苦于以下问题:Python get_admin_state_up_filter函数的具体用法?Python get_admin_state_up_filter怎么用?Python get_admin_state_up_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_admin_state_up_filter函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _agent_notification

    def _agent_notification(self, context, method, routers):
        """Notify l3 metering agents hosted by l3 agent hosts."""
        adminContext = context if context.is_admin else context.elevated()
        plugin = manager.NeutronManager.get_service_plugins().get(
            service_constants.L3_ROUTER_NAT)

        l3_routers = {}
        state = agentschedulers_db.get_admin_state_up_filter()
        for router in routers:
            l3_agents = plugin.get_l3_agents_hosting_routers(
                adminContext, [router['id']],
                admin_state_up=state,
                active=True)
            for l3_agent in l3_agents:
                LOG.debug('Notify metering agent at %(topic)s.%(host)s '
                          'the message %(method)s',
                          {'topic': self.topic,
                           'host': l3_agent.host,
                           'method': method})

                l3_router = l3_routers.get(l3_agent.host, [])
                l3_router.append(router)
                l3_routers[l3_agent.host] = l3_router

        for host, routers in l3_routers.iteritems():
            cctxt = self.client.prepare(server=host)
            cctxt.cast(context, method, routers=routers)
开发者ID:Akanksha08,项目名称:neutron,代码行数:27,代码来源:metering_rpc_agent_api.py

示例2: _agent_notification_arp

 def _agent_notification_arp(self, context, method, router_id,
                             operation, data):
     """Notify arp details to l3 agents hosting router."""
     if not router_id:
         return
     adminContext = (context.is_admin and
                     context or context.elevated())
     plugin = manager.NeutronManager.get_service_plugins().get(
         service_constants.L3_ROUTER_NAT)
     state = agentschedulers_db.get_admin_state_up_filter()
     l3_agents = (plugin.
                  get_l3_agents_hosting_routers(adminContext,
                                                [router_id],
                                                admin_state_up=state,
                                                active=True))
     # TODO(murali): replace cast with fanout to avoid performance
     # issues at greater scale.
     for l3_agent in l3_agents:
         log_topic = '%s.%s' % (l3_agent.topic, l3_agent.host)
         LOG.debug('Casting message %(method)s with topic %(topic)s',
                   {'topic': log_topic, 'method': method})
         dvr_arptable = {'router_id': router_id,
                         'arp_table': data}
         cctxt = self.client.prepare(topic=l3_agent.topic,
                                     server=l3_agent.host,
                                     version='1.2')
         cctxt.cast(context, method, payload=dvr_arptable)
开发者ID:davidcusatis,项目名称:neutron,代码行数:27,代码来源:l3_rpc_agent_api.py

示例3: get_hosts_to_notify

    def get_hosts_to_notify(self, context, router_id):
        """Returns all hosts to send notification about router update"""
        hosts = super(L3_DVRsch_db_mixin, self).get_hosts_to_notify(
            context, router_id)
        router = self.get_router(context, router_id)
        if router.get('distributed', False):
            dvr_hosts = self._get_dvr_hosts_for_router(context, router_id)
            dvr_hosts = set(dvr_hosts) - set(hosts)
            state = agentschedulers_db.get_admin_state_up_filter()
            agents = self.get_l3_agents(context, active=state,
                                        filters={'host': dvr_hosts})
            hosts += [a.host for a in agents]

        return hosts
开发者ID:cubeek,项目名称:neutron,代码行数:14,代码来源:l3_dvrscheduler_db.py

示例4: _agent_notification

 def _agent_notification(self, context, method, router_ids, operation, shuffle_agents):
     """Notify changed routers to hosting l3 agents."""
     adminContext = context if context.is_admin else context.elevated()
     plugin = manager.NeutronManager.get_service_plugins().get(service_constants.L3_ROUTER_NAT)
     state = agentschedulers_db.get_admin_state_up_filter()
     for router_id in router_ids:
         l3_agents = plugin.get_l3_agents_hosting_routers(
             adminContext, [router_id], admin_state_up=state, active=True
         )
         if shuffle_agents:
             random.shuffle(l3_agents)
         for l3_agent in l3_agents:
             LOG.debug(
                 "Notify agent at %(topic)s.%(host)s the message " "%(method)s",
                 {"topic": l3_agent.topic, "host": l3_agent.host, "method": method},
             )
             cctxt = self.client.prepare(topic=l3_agent.topic, server=l3_agent.host, version="1.1")
             cctxt.cast(context, method, routers=[router_id])
开发者ID:balagopalraj,项目名称:clearlinux,代码行数:18,代码来源:l3_rpc_agent_api.py

示例5: get_dvr_snat_agent_list

 def get_dvr_snat_agent_list(self, context):
     agent_filters = {'agent_modes': [n_const.L3_AGENT_MODE_DVR_SNAT]}
     state = agentschedulers_db.get_admin_state_up_filter()
     return self.get_l3_agents(context, active=state,
                               filters=agent_filters)
开发者ID:cubeek,项目名称:neutron,代码行数:5,代码来源:l3_dvrscheduler_db.py

示例6: get_hosts_to_notify

 def get_hosts_to_notify(self, context, router_id):
     """Returns all hosts to send notification about router update"""
     state = agentschedulers_db.get_admin_state_up_filter()
     agents = self.get_l3_agents_hosting_routers(
         context, [router_id], admin_state_up=state, active=True)
     return [a.host for a in agents]
开发者ID:HoratiusTang,项目名称:neutron,代码行数:6,代码来源:l3_agentschedulers_db.py


注:本文中的neutron.db.agentschedulers_db.get_admin_state_up_filter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。