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


Python LoadBalancerRule.create方法代碼示例

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


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

示例1: create_LB_Rule

# 需要導入模塊: from marvin.integration.lib.base import LoadBalancerRule [as 別名]
# 或者: from marvin.integration.lib.base.LoadBalancerRule import create [as 別名]
    def create_LB_Rule(self, public_ip, network, vmarray, services=None):
        self.debug("Creating LB rule for IP address: %s" %
                                        public_ip.ipaddress.ipaddress)
        objservices = None
        if services:
            objservices = services
        else:
            objservices = self.services["lbrule"]

        lb_rule = LoadBalancerRule.create(
                                    self.apiclient,
                                    objservices,
                                    ipaddressid=public_ip.ipaddress.id,
                                    accountid=self.account.name,
                                    networkid=network.id,
                                    vpcid=self.vpc.id,
                                    domainid=self.account.domainid
                                )
        self.debug("Adding virtual machines %s and %s to LB rule" % (vmarray[0], vmarray[1]))
        lb_rule.assign(self.apiclient, vmarray)

        self.debug("Adding NetworkACl rules to make NAT rule accessible")
        nwacl_nat = NetworkACL.create(self.apiclient,
                                    objservices,
                                    networkid=network.id,
                                    traffictype='Ingress'
                                    )
        self.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
        return lb_rule
開發者ID:baishuo,項目名稱:cloudstack,代碼行數:31,代碼來源:test_vpc_network_lbrules.py

示例2: create_LB_Rule

# 需要導入模塊: from marvin.integration.lib.base import LoadBalancerRule [as 別名]
# 或者: from marvin.integration.lib.base.LoadBalancerRule import create [as 別名]
    def create_LB_Rule(self, public_ip, network, vmarray, services=None):
        self.debug("Creating LB rule for IP address: %s" % public_ip.ipaddress.ipaddress)
        objservices = None
        if services:
            objservices = services
        else:
            objservices = self.services["lbrule"]

        lb_rule = LoadBalancerRule.create(
            self.apiclient,
            objservices,
            ipaddressid=public_ip.ipaddress.id,
            accountid=self.account.name,
            networkid=network.id,
            vpcid=self.vpc.id,
            domainid=self.account.domainid,
        )
        self.debug("Adding virtual machines %s and %s to LB rule" % (vmarray))
        lb_rule.assign(self.apiclient, vmarray)
        return lb_rule
開發者ID:vogxn,項目名稱:cloudstack,代碼行數:22,代碼來源:test_vpc_network_pfrules.py


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