Shutting down servers is a common operations for managing a cluster. However, if this server is configured to a Xen Dom0 and has Xen VMs (DomUs), the VMs should be shutdown first to avoid data lost on these VMs.
xm supports a
-a option to shutdown all VMs:
# xm shutdown -a
-w if you want to make it wait for the domain to complete shutdown before returning
Thanks to Eugene for this tips. The script below is a “poor man”‘s solution.
I wrote a Bash script to automatically list all running VMs and shutdown them down by calling
xm which I use to shutdown VMs on servers before turning them off.
xen-shutdown-all.sh script is on github:
This script use the
xm command for management. If you are using a newer version of Xen which possibly uses
xl for VM management, you can easily change the script by replacing
xl and make other possibly required changes.
Latest posts by Eric Zhiqiang Ma (see all)
- Vim Tutorial for Beginners: vimtutor - Dec 31, 2016
- Essential Gnome Shell Extensions for Gnome 3 Users - Oct 22, 2016
- How to Install 32-bit Wine 1.8 on CentOS 7 - Oct 16, 2016