当前位置: 首页>>代码示例>>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;未经允许,请勿转载。