Proxmox VM events (hooks)

Ivan Kit

New Member
Jun 16, 2016
1
0
1
43
Hi all,

We are testing Proxmox installation for our company QA cloud and we need a way to execute a command onc after new VM was created.

It is required for QEMU port redirection since setting redir option is not available on GUI and we are using Proxmox simple NAT and only need 1 port on every VM to be available externally.

Is there a way to hook to proxmox vm post-create event (trigger) and execute a binary with vm id as an attribute? This script will call something like qm set 102 -args "--redir tcp:30102::3389" to set a required option.

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.

Thank you!
 
Hi,

you could omit the GUI for completion completely and just use the
Code:
qm create VMID ...
command, there you would be able to directly set the args parameter, that would probably the fastest, but a little less user friendly (depends if you are more used to GUIs or command line).

That would be the way I chose, as its the most straightforward, IMO, also it can be scripted quite good.

Code:
qm help create
# or
man qm

Shows the - quite extensive - list of possible parameters with their expected format.

Event hooks are not integrated form VM creation.
 

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!