[SOLVED] Best way to detect what node a VM is moved to (HA)

Gh0st

Member
Apr 15, 2021
29
4
8
40
Hii everyone,

So iv been playing about with HA on some OVH servers. It works but I need to code a script to point the VMs IP to the new node when they are moved. (I do not have access to vrack) . I'm wondering what the best way to do this is. I could write a function to query the Proxmox API every minute or something to pull back a list of VMs on each node but this seems excessive. What API call would you use to detect where and when VMs are migrated?
 
one way with the api would be to query '/cluster/resources' since that gives back all vms with their respective node so you don't have to query for each node seperately

what could also work would be running a hookscript namely the 'post-start' (or 'pre-start') hook, though i am not sure if that triggers on migration (see 'man qm' for details)