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

Gh0st

Member
Apr 15, 2021
29
4
8
39
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)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!