Hi.
I’m testing a host_hook and when i stop a libvirtd service my hook starts.
How add exclusion, that when a libvirtd service stops host_hook doesn’t start?
Hello @perrfect
Hooks can be applied to state changes or API calls. So if the hosts changes its state to error there is no way to discriminate if it was due to libvirt stops or other reason. But, in the script that is run when the hook is triggered, you can add some logic to do nothing when the reason is that libvirt has stopped.
Best,
Álex.
Thank you for reply.
How should look like logic to do nothing when libvirt has stopped in my hook?
Now the hook look like:
ARGUMENTS = "$TEMPLATE -m -p 5" COMMAND = "ft/host_error.rb" NAME = "host_error" STATE = "ERROR" REMOTE = "no" RESOURCE = HOST TYPE = state
Hello @perrfect
That hook looks great! Now you need to modify the ft/host_error.rb
so when libvirt stops you do nothing.
Best,
Álex.