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

Lindsay Mathieson lindsay.mathieson at gmail.com
Thu Jan 15 09:24:35 CET 2015


On 15 January 2015 at 17:08, Lindsay Mathieson <lindsay.mathieson at gmail.com>
wrote:

> I'm adapting spice-example.sh to just require a VMID, so we can launch a
> spice client from the cmd line without needing to know which node it is on.
>
> Is there an API call for finding a VM's node from its id? or an
> alternative way of handling this?
>


/pools/<PoolName> is sufficient broad for my purposes - doesn't list all
vms, but I can pass a pool name, confident that the VM will be in there.
I'm using jq to parse the JSON output, so:

pvesh get /pools/$POOLNAME |jq -r ".members[] | select(.vmid == $VMID) |
.node"

returns the node for a vm




-- 
Lindsay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pve.proxmox.com/pipermail/pve-devel/attachments/20150115/a093237e/attachment.html>


More information about the pve-devel mailing list