本文整理汇总了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
示例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