本文整理汇总了Python中pyvcloud.vcd.vdc.VDC.add_disk方法的典型用法代码示例。如果您正苦于以下问题:Python VDC.add_disk方法的具体用法?Python VDC.add_disk怎么用?Python VDC.add_disk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vdc.VDC
的用法示例。
在下文中一共展示了VDC.add_disk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_disk
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import add_disk [as 别名]
def create_disk(client):
logging.info('INIT create_disk')
logged_in_org = client.get_org()
org = Org(client, resource=logged_in_org)
v = org.get_vdc('OVD2')
if v is None:
raise errors.VDCNotFoundError(vappInfo.vdc)
vdc = VDC(client, href=v.get('href'))
#task=vdc.delete_disk('disk01')
result = vdc.add_disk('disk02', "100")
logging.info('DONE create_disk %s', result)
task = client.get_task_monitor().wait_for_status(
task=result.Tasks.Task[0],
timeout=60,
poll_frequency=2,
fail_on_status=None,
expected_target_statuses=[
TaskStatus.SUCCESS, TaskStatus.ABORTED, TaskStatus.ERROR,
TaskStatus.CANCELED
],
callback=task_callback)
st = task.get('status')
if st == TaskStatus.SUCCESS.value:
logging.info("__LOG__ created DISK")
#cresult.created = True
else:
raise errors.VCDDiskCreationError(
etree.tostring(task, pretty_print=True))