为什么 libvirt virdomain guest os 可能会忽略重新启动或关机的请求?
why libvirt virdomain guest os mayignore the request to reboot or shutdown?
来自 libvirt-domain 的 virdomain class 的重启功能:
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 虚拟机不响应重新启动或关闭的请求,但它响应重置请求。我想知道为什么以及我能做什么。谢谢~
你没有提到你使用的是哪个管理程序,所以我会在我的回答中假设 QEMU/KVM。
shutdown
和 reboot
有两种工作方式。
libvirt/QEMU 采用的默认方法是注入 ACPI 电源按钮事件。大多数来宾 OS 的构建使得某些东西会看到 ACPI 事件并开始正常关机,但情况并非总是如此。对于重新启动,libvirt 将执行相同的 ACPI 电源按钮注入,但是当来宾完成其关闭序列时,它将被重置,以便再次启动。
第二种可选方法是在客户机中安装 QEMU 客户机代理 OS。然后您可以告诉 virsh 使用来宾代理来触发 shutdown/reboot。来宾代理仅适用于某些 OS,现代 Linux 和 windows 如果您安装了 virtio 驱动程序包。
A virsh reset
完全不同 - 它只是立即重置虚拟 CPU,导致来宾立即重新启动,没有正常关闭过程。
来自 libvirt-domain 的 virdomain class 的重启功能:
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 虚拟机不响应重新启动或关闭的请求,但它响应重置请求。我想知道为什么以及我能做什么。谢谢~
你没有提到你使用的是哪个管理程序,所以我会在我的回答中假设 QEMU/KVM。
shutdown
和 reboot
有两种工作方式。
libvirt/QEMU 采用的默认方法是注入 ACPI 电源按钮事件。大多数来宾 OS 的构建使得某些东西会看到 ACPI 事件并开始正常关机,但情况并非总是如此。对于重新启动,libvirt 将执行相同的 ACPI 电源按钮注入,但是当来宾完成其关闭序列时,它将被重置,以便再次启动。
第二种可选方法是在客户机中安装 QEMU 客户机代理 OS。然后您可以告诉 virsh 使用来宾代理来触发 shutdown/reboot。来宾代理仅适用于某些 OS,现代 Linux 和 windows 如果您安装了 virtio 驱动程序包。
A virsh reset
完全不同 - 它只是立即重置虚拟 CPU,导致来宾立即重新启动,没有正常关闭过程。