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

linux – KVM:从内部关闭guest虚拟机时运行脚本?

发布时间:2020-12-13 16:52:42 所属栏目:Linux 来源:网络整理
导读:我正在运行KVM作为虚拟化引擎. 当guest虚拟机从内部关闭时,有没有办法让QEMU / libvirt在主机上运行脚本(shutdown -h now)? 我希望能够在访客停止时运行一些自定义清理任务. 解决方法 libvirt提供了使用 hooks for specific system management的可能性: At
我正在运行KVM作为虚拟化引擎.

当guest虚拟机从内部关闭时,有没有办法让QEMU / libvirt在主机上运行脚本(shutdown -h now)?

我希望能够在访客停止时运行一些自定义清理任务.

解决方法

libvirt提供了使用 hooks for specific system management的可能性:
At present,there are three hook scripts that can be called:

    /etc/libvirt/hooks/daemon

    Executed when the libvirt daemon is started,stopped,or reloads its configuration

    /etc/libvirt/hooks/qemu

    Executed when a QEMU guest is started,or migrated

    /etc/libvirt/hooks/lxc

    Executed when an LXC guest is started or stopped

(编辑:李大同)

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

    推荐文章
      热点阅读