本文整理汇总了Python中pyvcloud.vcd.vdc.VDC.get_disk方法的典型用法代码示例。如果您正苦于以下问题:Python VDC.get_disk方法的具体用法?Python VDC.get_disk怎么用?Python VDC.get_disk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vdc.VDC
的用法示例。
在下文中一共展示了VDC.get_disk方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_060_attach_disk_to_vm_in_vapp
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_disk [as 别名]
def test_060_attach_disk_to_vm_in_vapp(self):
logged_in_org = self.client.get_org()
org = Org(self.client, resource=logged_in_org)
vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
vdc = VDC(self.client, resource=vdc_resource)
assert self.config['vcd']['vdc'] == vdc.get_resource().get('name')
vapp_resource = vdc.get_vapp(self.config['vcd']['vapp'])
assert self.config['vcd']['vapp'] == vapp_resource.get('name')
vapp = VApp(self.client, resource=vapp_resource)
disk = vdc.get_disk(self.config['vcd']['idisk_name'])
result = vapp.attach_disk_to_vm(disk_href=disk.get('href'),
vm_name=self.config['vcd']['vm'])
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
示例2: test_030_get_disk_by_name
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_disk [as 别名]
def test_030_get_disk_by_name(self):
logged_in_org = self.client.get_org()
org = Org(self.client, resource=logged_in_org)
vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
vdc = VDC(self.client, resource=vdc_resource)
fetched_disk = vdc.get_disk(name=self.config['vcd']['idisk_name'])
assert fetched_disk is not None
assert fetched_disk.get('name') == self.config['vcd']['idisk_name']
示例3: info
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_disk [as 别名]
def info(ctx, name):
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)
name, id = extract_name_and_id(name)
disk = vdc.get_disk(name=name, disk_id=id)
stdout(disk_to_dict(disk), ctx)
except Exception as e:
stderr(e, ctx)
示例4: test_040_get_disk_by_id
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_disk [as 别名]
def test_040_get_disk_by_id(self):
logged_in_org = self.client.get_org()
org = Org(self.client, resource=logged_in_org)
vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
vdc = VDC(self.client, resource=vdc_resource)
disks = vdc.get_disks()
assert len(disks) > 0
fetched_disk = vdc.get_disk(disk_id=disks[0].get('id'))
assert fetched_disk is not None
示例5: test_050_change_idisk_owner
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_disk [as 别名]
def test_050_change_idisk_owner(self):
logged_in_org = self.client.get_org()
org = Org(self.client, resource=logged_in_org)
vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
vdc = VDC(self.client, resource=vdc_resource)
user_resource = org.get_user(
self.config['vcd']['idisk_new_owner_name'])
vdc.change_disk_owner(name=self.config['vcd']['idisk_name'],
user_href=user_resource.get('href'))
disk_resource = vdc.get_disk(self.config['vcd']['idisk_name'])
new_user = disk_resource.Owner.User.get('name')
assert self.config['vcd']['idisk_new_owner_name'] == new_user
示例6: detach
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_disk [as 别名]
def detach(ctx, vapp_name, vm_name, disk_name):
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)
disk_name, disk_id = extract_name_and_id(disk_name)
disk = vdc.get_disk(name=disk_name, disk_id=disk_id)
vapp_resource = vdc.get_vapp(vapp_name)
vapp = VApp(client, resource=vapp_resource)
task = vapp.detach_disk_from_vm(
disk_href=disk.get('href'), vm_name=vm_name)
stdout(task, ctx)
except Exception as e:
stderr(e, ctx)