LibvirtClient.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:katprep 作者: stdevel 项目源码 文件源码
def has_snapshot(self, vm_name, snapshot_title):
        """
        Returns whether a particular virtual machine is currently protected
        by a snapshot. This requires specifying a VM name.

        :param vm_name: Name of a virtual machine
        :type vm_name: str
        :param snapshot_title: Snapshot title
        :type snapshot_title: str
        """
        try:
            #find VM and get all snapshots
            target_vm = self.SESSION.lookupByName(vm_name)
            target_snapshots = target_vm.snapshotListNames(0)
            if snapshot_title in target_snapshots:
                return True
        except libvirt.libvirtError as err:
            self.LOGGER.error("Unable to determine snapshot: '{}'".format(err))
            raise SessionException(err)
        except Exception as err:
            raise SessionException(err)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号