我正在运行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