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


Python LoadbalancerPoolSM.get方法代码示例

本文整理汇总了Python中config_db.LoadbalancerPoolSM.get方法的典型用法代码示例。如果您正苦于以下问题:Python LoadbalancerPoolSM.get方法的具体用法?Python LoadbalancerPoolSM.get怎么用?Python LoadbalancerPoolSM.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config_db.LoadbalancerPoolSM的用法示例。


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

示例1: audit_lb_pools

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
 def audit_lb_pools(self):
     for hm_id, config_data, driver_data in self._object_db.health_monitor_list():
         if HealthMonitorSM.get(hm_id):
             continue
         hm = config_data
         if not hasattr(hm, 'provider'):
             continue
         driver = self._get_driver_for_provider(hm['provider'])
         pools = set()
         for i in hm['pools'] or []:
             pools.add(i['pool_id'])
         try:
             for pool in pools:
                 driver.delete_health_monitor(hm, pool)
         except Exception:
             pass
         self._object_db.healthmonitor_remove(hm_id)
     for lb_id, config_data, driver_data in self._object_db.loadbalancer_list():
         if LoadbalancerSM.get(lb_id):
             continue
         # Delete the lb from the driver
         driver = self._get_driver_for_provider(config_data['provider'])
         driver.delete_loadbalancer(config_data)
         self._object_db.loadbalancer_remove(lb_id)
         self._delete_driver_for_loadbalancer(lb_id)
     for pool_id, config_data, driver_data in self._object_db.pool_list():
         if LoadbalancerPoolSM.get(pool_id):
             continue
         # Delete the pool from the driver
         driver = self._get_driver_for_provider(config_data['provider'])
         driver.delete_pool(config_data)
         self._object_db.pool_remove(pool_id)
         self._delete_driver_for_pool(pool_id)
开发者ID:Juniper,项目名称:contrail-controller,代码行数:35,代码来源:loadbalancer_agent.py

示例2: hm_get_reqdict

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
    def hm_get_reqdict(self, health_monitor):
        res = {'id': health_monitor.uuid,
               'tenant_id': health_monitor.parent_uuid.replace('-', ''),
               'status': self._get_object_status(health_monitor)}

        props = health_monitor.params
        for key, mapping in self._loadbalancer_health_type_mapping.iteritems():
            value = props[key]
            if value is not None:
                res[mapping] = value

        pool_ids = []
        pool_back_refs = health_monitor.loadbalancer_pools
        for pool_back_ref in pool_back_refs or []:
            pool_id = {}
            pool_id['pool_id'] = pool_back_ref
            pool_ids.append(pool_id)
        res['pools'] = pool_ids

        if pool_ids:
            pool = LoadbalancerPoolSM.get(pool_ids[0]['pool_id'])
            if pool:
                res['provider'] = pool.provider

        return res
开发者ID:nischalsheth,项目名称:contrail-controller,代码行数:27,代码来源:loadbalancer_agent.py

示例3: audit_lb_pools

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
 def audit_lb_pools(self):
     for pool_id, config_data, driver_data in self.lb_db.pool_list():
         if LoadbalancerPoolSM.get(pool_id):
             continue
         # Delete the pool from the driver
         driver = self._get_driver_for_provider(config_data['provider'])
         driver.delete_pool(config_data)
         self.lb_db.pool_remove(pool_id)
开发者ID:kirankp,项目名称:contrail-controller,代码行数:10,代码来源:loadbalancer_agent.py

示例4: _get_driver_for_pool

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
 def _get_driver_for_pool(self, pool_id, provider=None):
     if pool_id in self._pool_driver:
         return self._pool_driver[pool_id]
     if not provider:
         pool = LoadbalancerPoolSM.get(pool_id)
         provider = pool.provider
     if provider:
         driver = self._get_driver_for_provider(provider)
         self._pool_driver[pool_id] = driver
         return driver
     return self._loadbalancer_driver[self._default_provider]
开发者ID:Juniper,项目名称:contrail-controller,代码行数:13,代码来源:loadbalancer_agent.py

示例5: loadbalancer_member_get_reqdict

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
    def loadbalancer_member_get_reqdict(self, member):
        res = {"id": member.uuid, "pool_id": member.loadbalancer_pool, "status": self._get_object_status(member)}

        pool = LoadbalancerPoolSM.get(member.loadbalancer_pool)
        res["tenant_id"] = pool.parent_uuid.replace("-", "")

        props = member.params
        for key, mapping in self._loadbalancer_member_type_mapping.iteritems():
            value = props[key]
            if value is not None:
                res[mapping] = value

        return res
开发者ID:morganwang010,项目名称:contrail-controller,代码行数:15,代码来源:loadbalancer_agent.py

示例6: _send_lb_config_uve

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
 def _send_lb_config_uve(self, lb_id, deleted):
     lb = LoadbalancerSM.get(lb_id)
     if not lb:
         return
     sandesh = self._svc_mon.logger._sandesh
     if deleted == True:
         uve_lb = UveLoadbalancerConfig(name=lb.uuid, deleted=True)
         uve_lb.listener = {}
         uve_lb.pool = {}
         uve_trace = UveLoadbalancerConfigTrace(data=uve_lb, sandesh=sandesh)
         uve_trace.send(sandesh=sandesh)
         return
     uve_lb = UveLoadbalancerConfig()
     uve_lb.name = lb.uuid
     uve_lb.listener = {}
     uve_lb.pool = {}
     pool_found = False
     for ll_id in lb.loadbalancer_listeners:
         ll = LoadbalancerListenerSM.get(ll_id)
         if not ll:
             continue
         if not ll.params['admin_state']:
             continue
         ll_uuid = ll.uuid
         pools = []
         pool =  LoadbalancerPoolSM.get(ll.loadbalancer_pool)
         if pool and pool.params['admin_state']:
             pools.append(pool.uuid)
             uve_lb_listener = LoadbalancerConfig()
             uve_lb_listener.pool_uuid = pools
             uve_lb.listener[ll_uuid] = uve_lb_listener
             pool_uuid = pool.uuid
             pool_found = True
             members = []
             uve_lb_pool = LoadbalancerConfig()
             for member_id in pool.members:
                 member = LoadbalancerMemberSM.get(member_id)
                 members.append(member.uuid)
             uve_lb_pool.member_uuid = members
             uve_lb.pool[pool_uuid] = uve_lb_pool
     if pool_found == True:
         uve_trace = UveLoadbalancerConfigTrace(data=uve_lb, sandesh=sandesh)
         uve_trace.send(sandesh=sandesh)
     else:
         uve_lb = UveLoadbalancerConfig(name=lb.uuid, deleted=True)
         uve_lb.listener = {}
         uve_lb.pool = {}
         uve_trace = UveLoadbalancerConfigTrace(data=uve_lb, sandesh=sandesh)
         uve_trace.send(sandesh=sandesh)
     return
开发者ID:Juniper,项目名称:contrail-controller,代码行数:52,代码来源:loadbalancer_agent.py

示例7: _get_vip_vmi

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
    def _get_vip_vmi(self, si):
        if not si.loadbalancer_pool:
            return None

        pool = LoadbalancerPoolSM.get(si.loadbalancer_pool)
        if not pool.virtual_ip:
            return None

        vip = VirtualIpSM.get(pool.virtual_ip)
        if not vip.virtual_machine_interface:
            return None

        vmi = VirtualMachineInterfaceSM.get(vip.virtual_machine_interface)
        return vmi
开发者ID:kumaranjv061990,项目名称:contrail-controller,代码行数:16,代码来源:loadbalancer_agent.py

示例8: loadbalancer_member_get_reqdict

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
    def loadbalancer_member_get_reqdict(self, member):
        res = {'id': member.uuid,
               'vmi': member.vmi,
               'pool_id': member.loadbalancer_pool,
               'status': self._get_object_status(member)}

        pool = LoadbalancerPoolSM.get(member.loadbalancer_pool)
        res['tenant_id'] = pool.parent_uuid.replace('-', '')

        props = member.params
        for key, mapping in self._loadbalancer_member_type_mapping.iteritems():
            if key in props and props[key]:
                res[mapping] = props[key]

        return res
开发者ID:Juniper,项目名称:contrail-controller,代码行数:17,代码来源:loadbalancer_agent.py

示例9: _get_vip_vmi

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
    def _get_vip_vmi(self, si):
        lb = LoadbalancerSM.get(si.loadbalancer)
        if lb:
            vmi_id = lb.virtual_machine_interface
            vmi = VirtualMachineInterfaceSM.get(vmi_id)
            return vmi

        pool = LoadbalancerPoolSM.get(si.loadbalancer_pool)
        if pool:
            vip = VirtualIpSM.get(pool.virtual_ip)
            if vip:
                vmi_id = vip.virtual_machine_interface
                vmi = VirtualMachineInterfaceSM.get(vmi_id)
                return vmi

        return None
开发者ID:Juniper,项目名称:contrail-controller,代码行数:18,代码来源:loadbalancer_agent.py

示例10: _get_vip_vmi_iip

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
    def _get_vip_vmi_iip(self, si):
        if not si.loadbalancer_pool:
            return None, None

        pool = LoadbalancerPoolSM.get(si.loadbalancer_pool)
        if not pool.virtual_ip:
            return None, None

        vip = VirtualIpSM.get(pool.virtual_ip)
        if not vip.virtual_machine_interface:
            return None, None

        vmi = VirtualMachineInterfaceSM.get(vip.virtual_machine_interface)
        if not vmi.instance_ip or not vmi.virtual_network:
            return None, None

        return vmi.instance_ip, vmi.virtual_network
开发者ID:numansiddique,项目名称:contrail-controller,代码行数:19,代码来源:loadbalancer_agent.py

示例11: _get_vip_vmi

# 需要导入模块: from config_db import LoadbalancerPoolSM [as 别名]
# 或者: from config_db.LoadbalancerPoolSM import get [as 别名]
    def _get_vip_vmi(self, si):
        pool = LoadbalancerPoolSM.get(si.loadbalancer_pool)
        if not pool:
            return None

        listener = LoadbalancerListenerSM.get(pool.loadbalancer_listener)
        if listener:
            lb = LoadbalancerSM.get(listener.loadbalancer)
            vmi_id = lb.virtual_machine_interface
            vmi = VirtualMachineInterfaceSM.get(vmi_id)
            return vmi

        vip = VirtualIpSM.get(pool.virtual_ip)
        if vip:
            vmi_id = vip.virtual_machine_interface
            vmi = VirtualMachineInterfaceSM.get(vmi_id)
            return vmi

        return None
开发者ID:dminhk,项目名称:contrail-controller,代码行数:21,代码来源:loadbalancer_agent.py


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