HOST_HOOK on host.state ERROR when host.state is MONITORING_ERROR

Hello Developers,

I am stuck at strange situation regarding the FT HOST_HOOK.
I have HOST_HOOK configured to trigger on “ERROR” state. Before starting to migrate it is waiting 10 *monitoring_interval (seconds) and re-checking the host state.

The problem is that at this time the host.state is changed to 5 (MONITORING_ERROR). Your example script is configured to do the fail-over only if the state is 3 (ERROR): https://github.com/OpenNebula/one/blob/master/share/hooks/host_error.rb#L117

Is it ok to change the logic to trigger the VM migration procedure action if the state is 3 OR 5? Something like:

exit 0 if host.state != 3 or host.state != 5

Or there is another way to decide when to trigger or pass?

Kind Regards,
Anton Todorov

Hi

Yes a host in an ERROR state is periodically monitored to try to recover it. So it is moved from ERROR (3) —> MONITORING_ERROR (5). So a host in state 5 is host tying to be monitored that was previously in ERROR. Note that the MONITORING state is divided to return the host to the right state.

So I’d say that if you have already waited it is find to use 3 or 5.

Cheers