本文整理汇总了Python中pyvcloud.vcd.vapp.VApp.deploy方法的典型用法代码示例。如果您正苦于以下问题:Python VApp.deploy方法的具体用法?Python VApp.deploy怎么用?Python VApp.deploy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vapp.VApp
的用法示例。
在下文中一共展示了VApp.deploy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deploy
# 需要导入模块: from pyvcloud.vcd.vapp import VApp [as 别名]
# 或者: from pyvcloud.vcd.vapp.VApp import deploy [as 别名]
def deploy(self):
vapp_name = self.params.get('vapp_name')
response = dict()
response['changed'] = False
try:
vapp_resource = self.vdc.get_vapp(vapp_name)
vapp = VApp(self.client, name=vapp_name, resource=vapp_resource)
deploy_vapp_task = vapp.deploy()
self.execute_task(deploy_vapp_task)
response['msg'] = 'Vapp {} has been deployed.'.format(vapp_name)
response['changed'] = True
except OperationNotSupportedException:
response['warnings'] = 'Vapp {} is already deployed.'.format(vapp_name)
return response
示例2: test_1002_deploy_vapp
# 需要导入模块: from pyvcloud.vcd.vapp import VApp [as 别名]
# 或者: from pyvcloud.vcd.vapp.VApp import deploy [as 别名]
def test_1002_deploy_vapp(self):
logged_in_org = self.client.get_org()
org = Org(self.client, resource=logged_in_org)
v = org.get_vdc(self.config['vcd']['vdc'])
vdc = VDC(self.client, href=v.get('href'))
assert self.config['vcd']['vdc'] == vdc.get_resource().get('name')
vapp_resource = vdc.get_vapp(self.config['vcd']['vapp'])
assert vapp_resource.get('name') == self.config['vcd']['vapp']
vapp = VApp(self.client, resource=vapp_resource)
result = vapp.deploy()
task = self.client.get_task_monitor().wait_for_status(
task=result,
timeout=60,
poll_frequency=2,
fail_on_statuses=None,
expected_target_statuses=[
TaskStatus.SUCCESS,
TaskStatus.ABORTED,
TaskStatus.ERROR,
TaskStatus.CANCELED],
callback=None)
assert task.get('status') == TaskStatus.SUCCESS.value
示例3: deploy
# 需要导入模块: from pyvcloud.vcd.vapp import VApp [as 别名]
# 或者: from pyvcloud.vcd.vapp.VApp import deploy [as 别名]
def deploy(ctx, name, vm_names, power_on, force_customization):
try:
restore_session(ctx, vdc_required=True)
client = ctx.obj['client']
vdc_href = ctx.obj['profiles'].get('vdc_href')
vdc = VDC(client, href=vdc_href)
vapp_resource = vdc.get_vapp(name)
vapp = VApp(client, resource=vapp_resource)
if power_on is not None:
power_on = False
if force_customization is not None:
force_customization = True
if len(vm_names) == 0:
task = vapp.deploy(power_on=power_on)
stdout(task, ctx)
else:
for vm_name in vm_names:
vm = VM(client, href=vapp.get_vm(vm_name).get('href'))
vm.reload()
task = vm.deploy(
power_on=power_on, force_customization=force_customization)
stdout(task, ctx)
except Exception as e:
stderr(e, ctx)