Next Availale VMID and Available Templates through API

telemagic

New Member
Jan 20, 2013
18
2
1
Hi Guys

I am in the middle of having a module written for WHMCS to allow the automatic creation of Proxmox OpenVZ VM's however I am stuck on 2 issues.

I have banged my head against the API documentation and cannot work it out.

Firstly
How do I query the API to give me the next available VMID to assign the the VM?

and secondly
How do I get a list of available Templates?

Any help or pointers would be very much appreciated.

Regards
 
  • Like
Reactions: ams_tschoening
Firstly
How do I query the API to give me the next available VMID to assign the the VM?

Try:

# pvesh help -v /cluster/nextid

So the following should do the job:

# pvesh get /cluster/nextid

and secondly
How do I get a list of available Templates?

# pvesh get /cluster/resources -type vm

There is a template flag set (for qemu templates).
 
Hi

Thanks for the pointers Dietmar.

The nextid is exactly what im looking for.

The resources -type vm is just giving me a list of all VMs currently on the cluster.

I am looking for a way to pull the list of available templates for Container creation. Effectively an array of the contents of /var/lib/vz/template/cache

Regards
 
I am looking for a way to pull the list of available templates for Container creation. Effectively an array of the contents of /var/lib/vz/template/cache

# pvesh get /nodes/localhost/storage/local/content -content vztmpl
 

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!