當前位置: 首頁>>代碼示例>>Python>>正文


Python VncKubernetesConfig.is_public_fip_pool_configured方法代碼示例

本文整理匯總了Python中vnc_kubernetes_config.VncKubernetesConfig.is_public_fip_pool_configured方法的典型用法代碼示例。如果您正苦於以下問題:Python VncKubernetesConfig.is_public_fip_pool_configured方法的具體用法?Python VncKubernetesConfig.is_public_fip_pool_configured怎麽用?Python VncKubernetesConfig.is_public_fip_pool_configured使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vnc_kubernetes_config.VncKubernetesConfig的用法示例。


在下文中一共展示了VncKubernetesConfig.is_public_fip_pool_configured方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _get_public_fip_pool

# 需要導入模塊: from vnc_kubernetes_config import VncKubernetesConfig [as 別名]
# 或者: from vnc_kubernetes_config.VncKubernetesConfig import is_public_fip_pool_configured [as 別名]
    def _get_public_fip_pool(self):
        if self._fip_pool_obj:
            return self._fip_pool_obj

        if not vnc_kube_config.is_public_fip_pool_configured():
            return None

        fip_pool_fq_name = get_fip_pool_fq_name_from_dict_string(
            self._args.public_fip_pool)
        try:
            fip_pool_obj = self._vnc_lib.floating_ip_pool_read(fq_name=fip_pool_fq_name)
        except NoIdError:
            return None

        self._fip_pool_obj = fip_pool_obj
        return fip_pool_obj
開發者ID:nischalsheth,項目名稱:contrail-controller,代碼行數:18,代碼來源:vnc_service.py

示例2: _get_floating_ip

# 需要導入模塊: from vnc_kubernetes_config import VncKubernetesConfig [as 別名]
# 或者: from vnc_kubernetes_config.VncKubernetesConfig import is_public_fip_pool_configured [as 別名]
    def _get_floating_ip(self, name,
            proj_obj, external_ip=None, vmi_obj=None):
        if not vnc_kube_config.is_public_fip_pool_configured():
            return None

        try:
            fip_pool_fq_name = get_fip_pool_fq_name_from_dict_string(
                self._args.public_fip_pool)
        except Exception as e:
            string_buf = StringIO()
            cgitb_hook(file=string_buf, format="text")
            err_msg = string_buf.getvalue()
            self._logger.error("%s - %s" %(self._name, err_msg))
            return None

        if vmi_obj:
            fip_refs = vmi_obj.get_floating_ip_back_refs()
            for ref in fip_refs or []:
                fip = FloatingIpKM.get(ref['uuid'])
                if fip and fip.fq_name[:-1] == fip_pool_fq_name:
                    return fip
                else:
                    break
        fip_pool = self._get_public_fip_pool(fip_pool_fq_name)
        if fip_pool is None:
            return None
        fip_uuid = str(uuid.uuid4())
        fip_name = VncCommon.make_name(name, fip_uuid)
        fip_obj = FloatingIp(fip_name, fip_pool)
        fip_obj.uuid = fip_uuid
        fip_obj.set_project(proj_obj)
        if vmi_obj:
            fip_obj.set_virtual_machine_interface(vmi_obj)
        if external_ip:
            fip_obj.floating_ip_address = external_ip
        try:
            self._vnc_lib.floating_ip_create(fip_obj)
            fip = FloatingIpKM.locate(fip_obj.uuid)
        except Exception as e:
            string_buf = StringIO()
            cgitb_hook(file=string_buf, format="text")
            err_msg = string_buf.getvalue()
            self._logger.error("%s - %s" %(self._name, err_msg))
            return None
        return fip
開發者ID:cijohnson,項目名稱:contrail-controller,代碼行數:47,代碼來源:vnc_ingress.py

示例3: _get_public_fip_pool

# 需要導入模塊: from vnc_kubernetes_config import VncKubernetesConfig [as 別名]
# 或者: from vnc_kubernetes_config.VncKubernetesConfig import is_public_fip_pool_configured [as 別名]
    def _get_public_fip_pool(self):
        if self._fip_pool_obj:
            return self._fip_pool_obj

        if not vnc_kube_config.is_public_fip_pool_configured():
            return None

        fip_pool_fq_name = get_fip_pool_fq_name_from_dict_string(
            self._args.public_fip_pool)
        try:
            fip_pool_obj = self._vnc_lib.floating_ip_pool_read(fq_name=fip_pool_fq_name)
        except NoIdError:
            self.logger.notice("Public FIP Pool not found. "
                                "Floating IP will not be available "
                                "until FIP pool is configured.");
	    return None

        self._fip_pool_obj = fip_pool_obj
        return fip_pool_obj
開發者ID:Juniper,項目名稱:contrail-controller,代碼行數:21,代碼來源:vnc_service.py


注:本文中的vnc_kubernetes_config.VncKubernetesConfig.is_public_fip_pool_configured方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。