How can I shut down all VMs gracefully when the host shuts down?


Imagine this scenario:

Power outage, nobody is on site, UPS is about to give up. UPS sends signal to the host to shut down and the host initiates soft shut down procedure. How can I make so that the host first shuts down all VMs gracefully, then stops all Opennebula services (I think this one happens automatically) and after that shuts down itself.

Now the opposite scenario: I power on the host, it starts all Opennebula services (this one happens automatically), and finally it powers on all VMs that were shut down in the first scenario.

Please, share any thoughts about this.

Thank you!


The action you should execute is a poweroff or a suspend. VMs in poweroff/suspend are shutdown, but the disks are left in the host. These VMs are ready to be resumed in a moment when the host is back.
A stop/undeploy will move the disks back to the system DS, and this takes more time.

Any idea on a clean and simple solution to make this happen?

I’ve been wondering about this for a long time.


Are you test hooks? I think it’s your answer :slight_smile: