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


Python VncKubernetesConfig.cluster_default_network_fq_name方法代码示例

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


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

示例1: _get_host_vm

# 需要导入模块: from kube_manager.vnc.vnc_kubernetes_config import VncKubernetesConfig [as 别名]
# 或者: from kube_manager.vnc.vnc_kubernetes_config.VncKubernetesConfig import cluster_default_network_fq_name [as 别名]
    def _get_host_vm(host_ip):
        iip = InstanceIpKM.get_object(
            host_ip, vnc_kube_config.cluster_default_network_fq_name())
        if iip:
            for vmi_id in iip.virtual_machine_interfaces:
                vm_vmi = VirtualMachineInterfaceKM.get(vmi_id)
                if vm_vmi and vm_vmi.virtual_machine:
                    return vm_vmi.virtual_machine

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

示例2: _get_host_vmi

# 需要导入模块: from kube_manager.vnc.vnc_kubernetes_config import VncKubernetesConfig [as 别名]
# 或者: from kube_manager.vnc.vnc_kubernetes_config.VncKubernetesConfig import cluster_default_network_fq_name [as 别名]
    def _get_host_vmi(self, pod_name):
        host_ip = self._get_host_ip(pod_name)
        if host_ip:
            net_fq_name = vnc_kube_config.cluster_default_network_fq_name()
            iip = InstanceIpKM.get_object(host_ip, net_fq_name)

            if iip:
                for vmi_id in iip.virtual_machine_interfaces:
                    vm_vmi = VirtualMachineInterfaceKM.get(vmi_id)
                    if vm_vmi and vm_vmi.host_id:
                        return vm_vmi

        return None
开发者ID:nischalsheth,项目名称:contrail-controller,代码行数:15,代码来源:vnc_pod.py

示例3: _get_network

# 需要导入模块: from kube_manager.vnc.vnc_kubernetes_config import VncKubernetesConfig [as 别名]
# 或者: from kube_manager.vnc.vnc_kubernetes_config.VncKubernetesConfig import cluster_default_network_fq_name [as 别名]
    def _get_network(self, pod_id, pod_name, pod_namespace):
        """
        Get virtual network to be associated with the pod.
        The heuristics to determine which virtual network to use for the pod
        is as follows:
        if (virtual network is annotated in the pod config):
            Use virtual network configured on the pod.
        else if (virtual network if annotated in the pod's namespace):
            Use virtual network configured on the namespace.
        else if (pod is in a isolated namespace):
            Use the virtual network associated with isolated namespace.
        else:
            Use the pod virtual network associated with kubernetes cluster.
        """

        # Check for virtual-network configured on the pod.
        pod = PodKM.find_by_name_or_uuid(pod_id)
        if not pod:
            self._logger.notice("%s - Pod %s:%s:%s Not Found"
                                "(Might Got Delete Event From K8s)"
                                %(self._name, pod_namespace, pod_name, pod_id))
            return

        vn_fq_name = pod.get_vn_fq_name()
        ns = self._get_namespace(pod_namespace)

        # FIXME: Check if ns is not None
        # Check of virtual network configured on the namespace.
        if not vn_fq_name:
            vn_fq_name = ns.get_annotated_network_fq_name()

        # If the pod's namespace is isolated, use the isolated virtual
        # network.
        if not vn_fq_name:
            if self._is_pod_network_isolated(pod_namespace):
                vn_fq_name = ns.get_isolated_network_fq_name()

        # Finally, if no network was found, default to the cluster
        # pod network.
        if not vn_fq_name:
            vn_fq_name = vnc_kube_config.cluster_default_network_fq_name()

        vn_obj = self._vnc_lib.virtual_network_read(fq_name=vn_fq_name)
        return vn_obj
开发者ID:nischalsheth,项目名称:contrail-controller,代码行数:46,代码来源:vnc_pod.py

示例4: setUp

# 需要导入模块: from kube_manager.vnc.vnc_kubernetes_config import VncKubernetesConfig [as 别名]
# 或者: from kube_manager.vnc.vnc_kubernetes_config.VncKubernetesConfig import cluster_default_network_fq_name [as 别名]
 def setUp(self, *args, **kwargs):
     super(VncEndpointsNestedTest, self).setUp(*args, **kwargs)
     self.default_vn = self._vnc_lib.virtual_network_read(
         fq_name=VncKubernetesConfig.cluster_default_network_fq_name())
开发者ID:nischalsheth,项目名称:contrail-controller,代码行数:6,代码来源:test_vnc_endpoints.py


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