I have beenĀ using KVM for virtualization for quite some time now, probably more than a year. Though the initial use was on the servers which were rarely shutdown, now I’ve started using it in my home envir0nment where frequent restarts or shutdowns are there. The challenge that I faced was to automatically shutdown the KVM virtual machines when the system was shutdown or restarted.
Thanks to Joern at linux-kvm.com, I was able to setup a script which does an auto shutdown of the Linux (basically any VM which has ssh available) machines. I am using it on Ubuntu 9.04 (Jaunty Jackalope) 64 Bit Desktop edition.
Steps
- Add the host file entries
- Make sure you are able to do ssh without entering any password from root into the VMs
- Put the script into the /etc/init.d directory.
- Test the script before rebooting the system
- Reboot the system to check if it worked
Posted by Vivek Kapoor