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


Python VMHelper.lookup_vm_vdis方法代码示例

本文整理汇总了Python中nova.virt.xenapi.vm_utils.VMHelper.lookup_vm_vdis方法的典型用法代码示例。如果您正苦于以下问题:Python VMHelper.lookup_vm_vdis方法的具体用法?Python VMHelper.lookup_vm_vdis怎么用?Python VMHelper.lookup_vm_vdis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nova.virt.xenapi.vm_utils.VMHelper的用法示例。


在下文中一共展示了VMHelper.lookup_vm_vdis方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _destroy_rescue_vdis

# 需要导入模块: from nova.virt.xenapi.vm_utils import VMHelper [as 别名]
# 或者: from nova.virt.xenapi.vm_utils.VMHelper import lookup_vm_vdis [as 别名]
 def _destroy_rescue_vdis(self, rescue_vm_ref):
     """Destroys all VDIs associated with a rescued VM."""
     vdi_refs = VMHelper.lookup_vm_vdis(self._session, rescue_vm_ref)
     for vdi_ref in vdi_refs:
         try:
             self._session.call_xenapi("Async.VDI.destroy", vdi_ref)
         except self.XenAPI.Failure:
             continue
开发者ID:superstack,项目名称:nova,代码行数:10,代码来源:vmops.py

示例2: _destroy_vdis

# 需要导入模块: from nova.virt.xenapi.vm_utils import VMHelper [as 别名]
# 或者: from nova.virt.xenapi.vm_utils.VMHelper import lookup_vm_vdis [as 别名]
    def _destroy_vdis(self, instance, vm):
        """Destroys all VDIs associated with a VM """
        vdis = VMHelper.lookup_vm_vdis(self._session, vm)

        if not vdis:
            return

        for vdi in vdis:
            try:
                task = self._session.call_xenapi('Async.VDI.destroy', vdi)
                self._session.wait_for_task(instance.id, task)
            except self.XenAPI.Failure, exc:
                LOG.exception(exc)
开发者ID:anotherjesse,项目名称:nova,代码行数:15,代码来源:vmops.py

示例3: _destroy_vdis

# 需要导入模块: from nova.virt.xenapi.vm_utils import VMHelper [as 别名]
# 或者: from nova.virt.xenapi.vm_utils.VMHelper import lookup_vm_vdis [as 别名]
    def _destroy_vdis(self, instance, vm_ref):
        """Destroys all VDIs associated with a VM"""
        instance_id = instance.id
        LOG.debug(_("Destroying VDIs for Instance %(instance_id)s")
                  % locals())
        vdi_refs = VMHelper.lookup_vm_vdis(self._session, vm_ref)

        if not vdi_refs:
            return

        for vdi_ref in vdi_refs:
            try:
                task = self._session.call_xenapi('Async.VDI.destroy', vdi_ref)
                self._session.wait_for_task(task, instance.id)
            except self.XenAPI.Failure, exc:
                LOG.exception(exc)
开发者ID:pombredanne,项目名称:nova,代码行数:18,代码来源:vmops.py

示例4: unrescue

# 需要导入模块: from nova.virt.xenapi.vm_utils import VMHelper [as 别名]
# 或者: from nova.virt.xenapi.vm_utils.VMHelper import lookup_vm_vdis [as 别名]
    def unrescue(self, instance, callback):
        """Unrescue the specified instance
            - unplug the instance VM's disk from the rescue VM
            - teardown the rescue VM
            - release the bootlock to allow the instance VM to start

        """
        rescue_vm_ref = VMHelper.lookup(self._session,
                                    instance.name + "-rescue")

        if not rescue_vm_ref:
            raise exception.NotFound(_(
                "Instance is not in Rescue Mode: %s" % instance.name))

        original_vm_ref = self._get_vm_opaque_ref(instance)
        vbd_refs = self._session.get_xenapi().VM.get_VBDs(rescue_vm_ref)

        instance._rescue = False

        for vbd_ref in vbd_refs:
            _vbd_ref = self._session.get_xenapi().VBD.get_record(vbd_ref)
            if _vbd_ref["userdevice"] == "1":
                VMHelper.unplug_vbd(self._session, vbd_ref)
                VMHelper.destroy_vbd(self._session, vbd_ref)

        task1 = self._session.call_xenapi("Async.VM.hard_shutdown",
                                          rescue_vm_ref)
        self._session.wait_for_task(task1, instance.id)

        vdi_refs = VMHelper.lookup_vm_vdis(self._session, rescue_vm_ref)
        for vdi_ref in vdi_refs:
            try:
                task = self._session.call_xenapi('Async.VDI.destroy', vdi_ref)
                self._session.wait_for_task(task, instance.id)
            except self.XenAPI.Failure:
                continue

        task2 = self._session.call_xenapi('Async.VM.destroy', rescue_vm_ref)
        self._session.wait_for_task(task2, instance.id)

        self._release_bootlock(original_vm_ref)
        self._start(instance, original_vm_ref)
开发者ID:pombredanne,项目名称:nova,代码行数:44,代码来源:vmops.py


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