本文整理汇总了Python中fuelclient.objects.environment.Environment.create方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.create方法的具体用法?Python Environment.create怎么用?Python Environment.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fuelclient.objects.environment.Environment
的用法示例。
在下文中一共展示了Environment.create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from fuelclient.objects.environment import Environment [as 别名]
# 或者: from fuelclient.objects.environment.Environment import create [as 别名]
def create(self, params):
"""To create an environment with name MyEnv and release id=1 run:
fuel env create --name MyEnv --rel 1
By default, it creates environment with ha_compact mode and
neutron with VLAN network segmentation as network provider
(WARNING: nova-network is deprecated since 6.1 release).
To specify other modes add optional arguments:
fuel env create --name MyEnv --rel 1 \\
--mode ha --network-mode neutron
"""
if params.net == "nova":
self.serializer.print_to_output(
{},
"Warning: nova-network is deprecated since 6.1 release."
)
env = Environment.create(
params.name,
params.release,
params.net,
params.nst
)
if params.mode:
data = env.set({'mode': params.mode})
else:
data = env.get_fresh_data()
self.serializer.print_to_output(
data,
u"Environment '{name}' with id={id}, mode={mode}"
u" and network-mode={net_provider} was created!"
.format(**data)
)
示例2: create
# 需要导入模块: from fuelclient.objects.environment import Environment [as 别名]
# 或者: from fuelclient.objects.environment.Environment import create [as 别名]
def create(self, params):
"""To create an environment with name MyEnv and release id=1 run:
fuel env create --name MyEnv --rel 1
By default, it creates environment setting neutron with VLAN
network segmentation as network provider
To specify other modes add optional arguments:
fuel env create --name MyEnv --rel 1 --net-segment-type vlan
"""
if params.nst == 'gre':
self.serializer.print_to_output(
{},
"WARNING: GRE network segmentation type is deprecated "
"since 7.0 release."
)
env = Environment.create(
params.name,
params.release,
params.nst,
)
data = env.get_fresh_data()
self.serializer.print_to_output(
data,
u"Environment '{name}' with id={id} was created!"
.format(**data)
)
示例3: create
# 需要导入模块: from fuelclient.objects.environment import Environment [as 别名]
# 或者: from fuelclient.objects.environment.Environment import create [as 别名]
def create(self, params):
"""To create an environment with name MyEnv and release id=1 run:
fuel env create --name MyEnv --rel 1
By default it creates environment in multinode mode, and nova
network mode, to specify other modes add optional arguments:
fuel env create --name MyEnv --rel 1 \\
--mode ha --network-mode neutron
"""
env = Environment.create(
params.name,
params.release,
params.net,
net_segment_type=params.nst
)
if params.mode:
data = env.set({'mode': params.mode})
else:
data = env.get_fresh_data()
self.serializer.print_to_output(
data,
u"Environment '{name}' with id={id}, mode={mode}"
u" and network-mode={net_provider} was created!"
.format(**data)
)