• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python agentschedulers_db.get_admin_state_up_filter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python agentschedulers_db.services_available函数代码示例发布时间:2022-05-27
下一篇:
Python _utils.resource_fields函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap