virsh auto restart after vm died

paskl asked:

We have several VMs on our system. Sometimes there seems to be an issue with RAM management on the host system and one system dies quietly.

We have setup the VMs to autostart on host start, which works fine. But what about this scenario:

  1. Host autostarts VMs on start up
  2. One VM dies quietly for whatever reason
  3. VM does not run anymore therefore some key services running on the VM are not available

How can I setup the VM to automatically restart itself when its not running (But dont spawn multiple instances) after initial autostart using virsh ?

Thanks

My answer:


Check your domain XML for the value of <on_crash>.

This should be set to:

  <on_crash>restart</on_crash>

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.