[Users] cli: how to get value of a parameter

Michael Pasternak mpastern at redhat.com
Sun Mar 18 09:07:56 UTC 2012


Hi,

On 03/18/2012 10:44 AM, Gianluca Cecchi wrote:
> Hello,
> going through http://www.ovirt.org/wiki/CLI to see some syntax hints.
> I don't see a way to get parameter of an object.
> For example if I want to see the size of a vmpool, how can I do it

you have two options for this:

1. show vmpool vmpool_name
2. list vmpools --show-all

the vmpool object have size property, if you want to access single property
in returned object, it will be possible after our cli will support pipe redirection.

> And is it possible to store values as variables and use then them for
> further commands?

this one of the features i have in my list.

> 
> I can run something like this but it seems quite unoptimezed...
> output redirection to see how many vms are up in a pool:
> [oVirt shell (connected)]# list vms --kwargs
> "vmpool-id=eba78b0e-6512-11e1-80c4-5254008e81ee;status-state=up" >
> /tmp/testfile
> 
> [oVirt shell (connected)]# shell grep id /tmp/testfile | wc -l
> 2
> 
> shell command to see the size of the pool itself, so can I add more
> vms to it if the previous :
> [oVirt shell (connected)]# show vmpool --name mypool
> 
> id         : eba78b0e-6512-11e1-80c4-5254008e81ee
> name       : mypool
> cluster-id : 99408929-82cf-4dc7-a532-9d998063fa95
> size       : 2
> 
> I would like only the size value and use it then...

i also have pipe support in my list, when it will be available,
you will be able to redirect shell output directly to grep.

> 
> Thanks in advance,
> Gianluca
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users


-- 

Michael Pasternak
RedHat, ENG-Virtualization R&D



More information about the Users mailing list