Since I was unable to find a solution to this and even with OpenNebula 5.5.90 I see that there is no option for autostart virtual machines in case of a opennebula node/server restart/reboot or power failure or whatever, I came up with this… Probably not the best way to achieve but as long as it works is just fine.
So I have OpenNebula 5.5.90 installed on a CentOS 7.x server. I have added this piece of code to the
automatically start mandatory KVM vms
df | grep "/var/lib/one"
ALWAYS_ON_KVMS=“2 3 4 5 6 7 8 9 10 11 12”
if [ -z “$IS_MOUNTED” ]
echo “Storage partition is not mounted on the server(s)”
echo “Storage partition is mounted on the server(s)”
for i in $ALWAYS_ON_KVMS; do onevm resume $i; done
You might not need that 60 seconds delay, in my case is necessary since there 2 opennebula servers which share the same partition which is in fact a DRBD resource and it’s mounted by pacemaker/corosync
The only issue with this solution is that, if you create more vms, then you have to update the file with their ids.
Hope it helps!
Note: Pay attention to quotes etc since the forum seems to be reformating the text and some special chars like ` " are not displayed correctly