For my need (see https://forum.proxmox.com/threads/running-hooks-when-incoming-migration-is-finished.54330 for some background), I need to run a hook script when a VM ends an incoming live migration. I'm trying to use the post-start hook. The idea : in the post-start hook, loop to see if the VM is running on the local node. If not, the migration is still running, if yes, it has finished the live migration and I can proceed with my custom script.
The problem is that hooks are blocking. Even post-start. As long as post-start has not returned, the migration won't proceed, as PVE consideres the VM is still starting. I tried to fork in my hook script, or to use a shell wrapper, calling the real one with &. But in both case it's the same. PVE dosn't start migration and juste blocks in the post-start hook. Not sure why, are hooks executed in a special cgroup which ensure even forks are ended ?
How can I fire a hook asynchronously ? I'd prefer not having to write a separate daemon which could receive signals from the hook script and do the async part
The problem is that hooks are blocking. Even post-start. As long as post-start has not returned, the migration won't proceed, as PVE consideres the VM is still starting. I tried to fork in my hook script, or to use a shell wrapper, calling the real one with &. But in both case it's the same. PVE dosn't start migration and juste blocks in the post-start hook. Not sure why, are hooks executed in a special cgroup which ensure even forks are ended ?
How can I fire a hook asynchronously ? I'd prefer not having to write a separate daemon which could receive signals from the hook script and do the async part