本文整理汇总了Python中pyvcloud.vcd.vdc.VDC.update_disk方法的典型用法代码示例。如果您正苦于以下问题:Python VDC.update_disk方法的具体用法?Python VDC.update_disk怎么用?Python VDC.update_disk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vdc.VDC
的用法示例。
在下文中一共展示了VDC.update_disk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_080_update_disk
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import update_disk [as 别名]
def test_080_update_disk(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)
result = vdc.update_disk(
name=self.config['vcd']['idisk_name'],
new_name=self.config['vcd']['idisk_new_name'],
new_size=self.config['vcd']['idisk_new_size'],
new_description=self.config['vcd']['idisk_new_description'],
new_storage_profile_name=self.config['vcd']['idisk_new_sp_name'],
new_iops=self.config['vcd']['idisk_new_iops'])
task = self.client.get_task_monitor().wait_for_status(
task=result,
timeout=30,
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: update
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import update_disk [as 别名]
def update(ctx, name, new_name, size, description, storage_profile, iops):
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)
new_size = None
if size is not None:
new_size = humanfriendly.parse_size(size)
name, id = extract_name_and_id(name)
task = vdc.update_disk(
name=name,
disk_id=id,
new_name=new_name,
new_size=new_size,
new_description=description,
new_storage_profile_name=storage_profile,
new_iops=iops)
stdout(task, ctx)
except Exception as e:
stderr(e, ctx)