[pve-devel] Finding a VM's Node via API

Lindsay Mathieson lindsay.mathieson at gmail.com
Thu Jan 15 11:49:49 CET 2015

On Thu, 15 Jan 2015 09:50:09 AM Dietmar Maurer wrote:
> # pvesh get /cluster/resources -type vm

perfect, thanks

> But I have no idea how to extract the result inside a shell script?

I use jq, which is a command line based json parser/filter. Its in wheezy 
backports and ubuntu main.

pvesh get /cluster/resources -type vm |jq -r ".[] | select(.vmid == 301) | 

returns just the node value for vmid = 301

More information about the pve-devel mailing list