本文整理汇总了Python中pyvcloud.vcd.vapp.VApp.disconnect_org_vdc_network方法的典型用法代码示例。如果您正苦于以下问题:Python VApp.disconnect_org_vdc_network方法的具体用法?Python VApp.disconnect_org_vdc_network怎么用?Python VApp.disconnect_org_vdc_network使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vapp.VApp
的用法示例。
在下文中一共展示了VApp.disconnect_org_vdc_network方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: disconnect
# 需要导入模块: from pyvcloud.vcd.vapp import VApp [as 别名]
# 或者: from pyvcloud.vcd.vapp.VApp import disconnect_org_vdc_network [as 别名]
def disconnect(ctx, name, network):
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)
task = vapp.disconnect_org_vdc_network(network)
stdout(task, ctx)
except Exception as e:
stderr(e, ctx)
示例2: test_102_disconnect_orgvdc_network
# 需要导入模块: from pyvcloud.vcd.vapp import VApp [as 别名]
# 或者: from pyvcloud.vcd.vapp.VApp import disconnect_org_vdc_network [as 别名]
def test_102_disconnect_orgvdc_network(self):
org_in_use = self.config['vcd']['org_in_use']
org = Org(self.client,
href=self.client.get_org_by_name(org_in_use).get('href'))
v = org.get_vdc(self.config['vcd']['vdc'])
vdc = VDC(self.client, href=v.get('href'))
vapp_resource = vdc.get_vapp(self.config['vcd']['vapp'])
vapp = VApp(self.client, resource=vapp_resource)
result = vapp.disconnect_org_vdc_network(self.config['vcd'][
'orgvdc_network'])
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