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

前端之家收集整理的这篇文章主要介绍了linux – KVM:从内部关闭guest虚拟机时运行脚本?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在运行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

猜你在找的Linux相关文章