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


Python VncCassandraClient._cassandra_loadbalancer_pool_list方法代码示例

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


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

示例1: SvcMonitor

# 需要导入模块: from cfgm_common.vnc_cassandra import VncCassandraClient [as 别名]
# 或者: from cfgm_common.vnc_cassandra.VncCassandraClient import _cassandra_loadbalancer_pool_list [as 别名]

#.........这里部分代码省略.........
        for si_fq_str, si in si_list or []:
            for idx in range(0, int(si.get('max-instances', '0'))):
                prefix = self.db.get_vm_db_prefix(idx)
                vm_key = prefix + 'uuid'
                if vm_key not in si.keys():
                    continue

                try:
                    vm_obj = self._vnc_lib.virtual_machine_read(id=si[vm_key])
                except NoIdError:
                    continue

                vmi_back_refs = vm_obj.get_virtual_machine_interface_back_refs()
                for vmi_back_ref in vmi_back_refs or []:
                    try:
                        vmi_obj = self._vnc_lib.virtual_machine_interface_read(
                            id=vmi_back_ref['uuid'])
                    except NoIdError:
                        continue
                    vmi_props = vmi_obj.get_virtual_machine_interface_properties()
                    if not vmi_props:
                        continue
                    if_type = vmi_props.get_service_interface_type()
                    if not if_type:
                        continue
                    key = prefix + 'if-' + if_type
                    self.db.service_instance_insert(si_fq_str,
                                                    {key:vmi_obj.uuid})

    def sync_sm(self):
        vn_set = set()
        vmi_set = set()
        iip_set = set()
        ok, lb_pool_list = self._cassandra._cassandra_loadbalancer_pool_list()
        if not ok:
            pass
        else:
            for fq_name, uuid in lb_pool_list:
                lb_pool = LoadbalancerPoolSM.locate(uuid)
                if lb_pool.virtual_machine_interface:
                    vmi_set.add(lb_pool.virtual_machine_interface)

        ok, lb_pool_member_list = self._cassandra._cassandra_loadbalancer_member_list()
        if not ok:
            pass
        else:
            for fq_name, uuid in lb_pool_member_list:
                lb_pool_member = LoadbalancerMemberSM.locate(uuid)

        ok, lb_vip_list = self._cassandra._cassandra_virtual_ip_list()
        if not ok:
            pass
        else:
            for fq_name, uuid in lb_vip_list:
                virtual_ip = VirtualIpSM.locate(uuid)
                if virtual_ip.virtual_machine_interface:
                    vmi_set.add(virtual_ip.virtual_machine_interface)

        ok, lb_hm_list = self._cassandra._cassandra_loadbalancer_healthmonitor_list()
        if not ok:
            pass
        else:
            for fq_name, uuid in lb_hm_list:
                lb_hm = HealthMonitorSM.locate(uuid)

        ok, si_list = self._cassandra._cassandra_service_instance_list()
开发者ID:haripk,项目名称:contrail-controller,代码行数:70,代码来源:svc_monitor.py

示例2: SvcMonitor

# 需要导入模块: from cfgm_common.vnc_cassandra import VncCassandraClient [as 别名]
# 或者: from cfgm_common.vnc_cassandra.VncCassandraClient import _cassandra_loadbalancer_pool_list [as 别名]

#.........这里部分代码省略.........
                if vm.virtualization_type:
                    continue
                nova_vm = self._nova_client.oper('servers', 'get',
                    si.proj_name, id=vm_id)
                if not nova_vm:
                    continue

                si_obj = ServiceInstance()
                si_obj.name = si.name
                si_obj.fq_name = si.fq_name
                instance_name = self.vm_manager._get_instance_name(
                    si_obj, vm.index)
                if vm.name == instance_name:
                    continue
                nova_vm.update(name=instance_name)
                vm_obj = VirtualMachine()
                vm_obj.uuid = vm_id
                vm_obj.fq_name = [vm_id]
                vm_obj.set_display_name(instance_name + '__' +
                    st.virtualization_type)
                try:
                    self._vnc_lib.virtual_machine_update(vm_obj)
                except Exception:
                    pass

    def launch_services(self):
        for si in ServiceInstanceSM.values():
            self._create_service_instance(si)

    def sync_sm(self):
        vn_set = set()
        vmi_set = set()
        iip_set = set()
        ok, lb_pool_list = self._cassandra._cassandra_loadbalancer_pool_list()
        if not ok:
            pass
        else:
            for fq_name, uuid in lb_pool_list:
                lb_pool = LoadbalancerPoolSM.locate(uuid)
                if lb_pool.virtual_machine_interface:
                    vmi_set.add(lb_pool.virtual_machine_interface)

        ok, lb_pool_member_list = self._cassandra._cassandra_loadbalancer_member_list()
        if not ok:
            pass
        else:
            for fq_name, uuid in lb_pool_member_list:
                lb_pool_member = LoadbalancerMemberSM.locate(uuid)

        ok, lb_vip_list = self._cassandra._cassandra_virtual_ip_list()
        if not ok:
            pass
        else:
            for fq_name, uuid in lb_vip_list:
                virtual_ip = VirtualIpSM.locate(uuid)
                if virtual_ip.virtual_machine_interface:
                    vmi_set.add(virtual_ip.virtual_machine_interface)

        ok, lb_hm_list = self._cassandra._cassandra_loadbalancer_healthmonitor_list()
        if not ok:
            pass
        else:
            for fq_name, uuid in lb_hm_list:
                lb_hm = HealthMonitorSM.locate(uuid)

        ok, si_list = self._cassandra._cassandra_service_instance_list()
开发者ID:overcastcloud,项目名称:contrail-controller,代码行数:70,代码来源:svc_monitor.py


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