示例#1
0
    def _status_code(self, domain:libvirt.virDomain):
        '''
        获取虚拟机的当前状态码

        :param domain: 虚拟机实例
        :return:
            success: state_code:int

        :raise VirtError()
        '''
        try:
            info = domain.info()
            return info[0]
        except libvirt.libvirtError as e:
            raise VirtError(err=e)
示例#2
0
    def status_code(domain: libvirt.virDomain):
        """
        获取虚拟机的当前状态码

        :param domain: 虚拟机实例
        :return:
            success: state_code:int

        :raise VirtError()
        """
        try:
            info = domain.info()
            return info[0]
        except libvirt.libvirtError as e:
            raise wrap_error(err=e)