We have Proxmox installation. We want to execute a command after new VM was added. It is required for QEMU port redirection since setting redir option is not avaialble on GUI: qm set 102 -args "--redir tcp:30102::3389"

Is there a way to hook to proxmox vm post-create event and execute a binary with vm id as an attribute?

As an alternative approach I was thinking about watching fs file create events under /etc/pve/qemu-server/ path, but I don't think it's a right way for doing that.


I had the same kind of problem. I wanted to change an IP failover redirection as soon as the virtual machine is migrated to another node but I could not find a clean way to detect the said migration.

The log files /var/log/pve/tasks/index does not help. Only the node that is giving the VM is having a line of log that says "qmigrate" or "hamigrate".

I've found a way to watch the /etc/pve/qemu-server files with inotifywait and then read the VM informations in that file and it's working. Also, you should exclude the tmp files detection, those are not relevant. Maybe there is a better way to do it, but that method works 100% of the time for me even when a node is down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.