本文整理汇总了Python中nova.virt.xenapi.vm_utils.VMHelper.scan_default_sr方法的典型用法代码示例。如果您正苦于以下问题:Python VMHelper.scan_default_sr方法的具体用法?Python VMHelper.scan_default_sr怎么用?Python VMHelper.scan_default_sr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nova.virt.xenapi.vm_utils.VMHelper
的用法示例。
在下文中一共展示了VMHelper.scan_default_sr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: link_disks
# 需要导入模块: from nova.virt.xenapi.vm_utils import VMHelper [as 别名]
# 或者: from nova.virt.xenapi.vm_utils.VMHelper import scan_default_sr [as 别名]
def link_disks(self, instance, base_copy_uuid, cow_uuid):
"""Links the base copy VHD to the COW via the XAPI plugin."""
new_base_copy_uuid = str(uuid.uuid4())
new_cow_uuid = str(uuid.uuid4())
params = {'instance_id': instance.id,
'old_base_copy_uuid': base_copy_uuid,
'old_cow_uuid': cow_uuid,
'new_base_copy_uuid': new_base_copy_uuid,
'new_cow_uuid': new_cow_uuid,
'sr_path': VMHelper.get_sr_path(self._session), }
task = self._session.async_call_plugin('migration',
'move_vhds_into_sr', {'params': pickle.dumps(params)})
self._session.wait_for_task(task, instance.id)
# Now we rescan the SR so we find the VHDs
VMHelper.scan_default_sr(self._session)
return new_cow_uuid
示例2: attach_disk
# 需要导入模块: from nova.virt.xenapi.vm_utils import VMHelper [as 别名]
# 或者: from nova.virt.xenapi.vm_utils.VMHelper import scan_default_sr [as 别名]
def attach_disk(self, instance, disk_info):
"""Links the base copy VHD to the COW via the XAPI plugin"""
vm_ref = VMHelper.lookup(self._session, instance.name)
new_base_copy_uuid = str(uuid.uuid4())
new_cow_uuid = str(uuid.uuid4())
params = {'instance_id': instance.id,
'old_base_copy_uuid': disk_info['base_copy'],
'old_cow_uuid': disk_info['cow'],
'new_base_copy_uuid': new_base_copy_uuid,
'new_cow_uuid': new_cow_uuid,
'sr_path': VMHelper.get_sr_path(self._session), }
task = self._session.async_call_plugin('migration',
'move_vhds_into_sr', {'params': pickle.dumps(params)})
self._session.wait_for_task(task, instance.id)
# Now we rescan the SR so we find the VHDs
VMHelper.scan_default_sr(self._session)
return new_cow_uuid