Vm autostart after hardware node reboot

Hello.

Is it possible to tell opennebula to autostart VMs after a hardware node reboot?

thanks and cheers
t.

Hi Thomas,
Iā€™d start reading this old forum post (https://forum.opennebula.io/t/automatically-restart-vms-after-host-restart/454) which discussed this issue and itā€™s quite interesting, with different proposals. In short it seems you can try to use hooks for VM (http://docs.opennebula.org/5.0/integration/infrastructure_integration/hooks.html) but again Iā€™d start with that post.

Cheers!

Thanks for the pointers Miguel.

cheers
t.

I still have problems autostart VMs after a hardware reboot. The hook seems to be executed but to early.

Tue Nov 22 08:43:57 2016 [Z0][ONE][E]: Error monitoring Host myhost (4): -
Tue Nov 22 08:43:57 2016 [Z0][ReM][D]: Req:1152 UID:0 VirtualMachineAction invoked , ā€œresumeā€, 299
Tue Nov 22 08:43:57 2016 [Z0][DiM][D]: Resuming VM 299
Tue Nov 22 08:43:57 2016 [Z0][ReM][D]: Req:1152 UID:0 VirtualMachineAction result SUCCESS, 299
Tue Nov 22 08:43:57 2016 [Z0][HKM][D]: Message received: EXECUTE SUCCESS 299 hook_vm_on_unknown:

Tue Nov 22 08:43:57 2016 [Z0][VMM][D]: Message received: LOG I 299 Command execution fail: /var/lib/one/remotes/tm/ssh/context /var/lib/one/vms/299/context.sh myhost:/var/lib/one//datastores/0/299/disk.1 299 0

Tue Nov 22 08:43:57 2016 [Z0][VMM][D]: Message received: LOG E 299 Error creating directory /var/lib/one/datastores/0/299 at myhost: ssh: connect to host myhost port 22: Connection refused

Tue Nov 22 08:43:57 2016 [Z0][VMM][D]: Message received: LOG I 299 ExitCode: 255

Tue Nov 22 08:43:57 2016 [Z0][VMM][D]: Message received: LOG I 299 Failed to execute transfer manager driver operation: tm_context.

Tue Nov 22 08:43:57 2016 [Z0][VMM][D]: Message received: DEPLOY FAILURE 299 Error creating directory /var/lib/one/datastores/0/299 at myhost: ssh: connect to host myhost port 22: Connection refused

Tue Nov 22 08:43:57 2016 [Z0][HKM][D]: Message received: EXECUTE SUCCESS 299 hook_vm_on_unknown:

Is there a way to tell opennebula to execute that hook /after/ the host is up?

thanks and cheers
t.

Got it working with:

VM_HOOK = [
name = ā€œautostart_hookā€,
on = ā€œCUSTOMā€,
state = ā€œACTIVEā€,
lcm_state = ā€œUNKNOWNā€,
command = ā€œ/usr/bin/env onevm resumeā€,
arguments = ā€œ$IDā€ ]

cheers
t.

2 Likes