首页 文章

为什么libvirt virdomain guest os mayignore要求重启或关机?

提问于
浏览
0

libvirt-domain的virdomain类的重启功能:

def reboot(self, flags=0):
        """Reboot a domain, the domain object is still usable thereafter, but
        the domain OS is being stopped for a restart.
        Note that the guest OS may ignore the request.
        Additionally, the hypervisor may check and support the domain
        'on_reboot' XML setting resulting in a domain that shuts down instead
        of rebooting.

        If @flags is set to zero, then the hypervisor will choose the
        method of shutdown it considers best. To have greater control
        pass one or more of the virDomainRebootFlagValues. The order
        in which the hypervisor tries each shutdown method is undefined,
        and a hypervisor is not required to support all methods.

        To use guest agent (VIR_DOMAIN_REBOOT_GUEST_AGENT) the domain XML
        must have <channel> configured.

        Due to implementation limitations in some drivers (the qemu driver,
        for instance) it is not advised to migrate or save a guest that is
        rebooting as a result of this API. Migrating such a guest can lead
        to a plain shutdown on the destination. """
        ret = libvirtmod.virDomainReboot(self._o, flags)
        if ret == -1: raise libvirtError ('virDomainReboot() failed', dom=self)
        return ret

并且我的qemu / kvm vm没有响应重启或关闭的请求,而它响应重置请求 . 我想知道为什么,我能做些什么 . 谢谢〜

1 回答

  • 0

    你没有提到你正在使用哪个管理程序,所以我会在我的答案中假设QEMU / KVM .

    有两种方法 shutdownreboot 可以工作 .

    libvirt / QEMU采用的默认方法是注入ACPI电源按钮事件 . 大多数客户操作系统都是这样构建的,以便某些东西可以看到ACPI事件并开始正常关闭,但情况并非总是如此 . 对于重新启动,libvirt将执行相同的ACPI电源按钮注入,但是当guest虚拟机完成其关闭序列时,它将被重置,以便再次启动 .

    第二种可选方法是在客户操作系统中安装QEMU来宾代理 . 然后,您可以告诉virsh使用来宾代理触发关闭/重新启动 . 客户代理仅适用于某些操作系统,现代Linux和Windows,如果您已安装virtio驱动程序包 .

    virsh reset 完全不同 - 这只是立即重置虚拟CPU,导致客户端立即重启,没有正常的关机过程 .

相关问题