当前位置: 首页>>代码示例>>Python>>正文


Python VMHelper.scan_default_sr方法代码示例

本文整理汇总了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
开发者ID:superstack,项目名称:nova,代码行数:21,代码来源:vmops.py

示例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
开发者ID:yosh,项目名称:nova,代码行数:22,代码来源:vmops.py


注:本文中的nova.virt.xenapi.vm_utils.VMHelper.scan_default_sr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。