加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – KVM可以在主机关闭时自动挂起或关闭guest虚拟机吗?

发布时间:2020-12-13 18:07:07 所属栏目:Linux 来源:网络整理
导读:我们有一个CentOS 5.5 KVM主机,运行各种版本的CentOS以及稍后可能的其他操作系统. 我们希望能够(a)自动向所有guest虚拟机发送ACPI关闭,或者(b)在主机关闭时暂停所有guest虚拟机到磁盘. 有没有一种标准方法可以完成其中任何一种,或者它是一种自己动手的情况?
我们有一个CentOS 5.5 KVM主机,运行各种版本的CentOS以及稍后可能的其他操作系统.

我们希望能够(a)自动向所有guest虚拟机发送ACPI关闭,或者(b)在主机关闭时暂停所有guest虚拟机到磁盘.

有没有一种标准方法可以完成其中任何一种,或者它是一种自己动手的情况?谢谢!

解决方法

是.

virsh shutdown命令(或使用libvirt的“shutdown”的其他实现,如virt-manager)指示客户操作系统干净地关闭.从手册页:

shutdown domain-id

   Gracefully shuts down a domain.  This coordinates with the domain
   OS to perform graceful shutdown,so there is no guarantee that it
   will succeed,and may take a variable length of time depending on
   what services must be shutdown in the domain.

   The exact behavior of a domain when it shuts down is set by the
   on_shutdown parameter in the domain’s XML definition.

使用KVM,这应该发送ACPI system_powerdown事件.

在Fedora和RHEL 6中,libvirt-guests init脚本开箱即用,配置为在系统关闭时挂起所有guest虚拟机.然而,这并不是特别神奇,因此可以将其复制到CentOS 5,只需稍加修改即可.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读