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

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? And is it possible to store values as variables and use then them for further commands? 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... Thanks in advance, Gianluca

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@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
-- Michael Pasternak RedHat, ENG-Virtualization R&D

2012/3/18 Michael Pasternak wrote:
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
yes, but they returns all the properties of an object. I would prefer to have an option that gives only the value of the property/properties I'm interested in something like show vmpool vmpool_name --props=prop1[,prop2,...,propN] eg show vmpool vmpool_name --props=size
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 also have pipe support in my list, when it will be available, you will be able to redirect shell output directly to grep.
Ok, fine to have them. So in ovirt-shell command, when you type "help" and you get " In addition to the basic command form, the following functionality is available: ... * The output of any command can be piped to a shell command with the '|' character. " Actually it is not implemented yet, correct? Because I tried some options but it seems none of them worked... BTW: getting results seems quite slow in my opinion. Does it depend on ovirt-shell itself or something I can tune in PotgreSQL RDBMS parameters perhaps? Gianluca

On 03/18/2012 02:43 PM, Gianluca Cecchi wrote:
2012/3/18 Michael Pasternak wrote:
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
yes, but they returns all the properties of an object. I would prefer to have an option that gives only the value of the property/properties I'm interested in something like show vmpool vmpool_name --props=prop1[,prop2,...,propN]
eg show vmpool vmpool_name --props=size
that's doable, can you file RFE on this?!
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 also have pipe support in my list, when it will be available, you will be able to redirect shell output directly to grep.
Ok, fine to have them. So in ovirt-shell command, when you type "help" and you get
" In addition to the basic command form, the following functionality is available: ... * The output of any command can be piped to a shell command with the '|' character. " Actually it is not implemented yet, corect?
true.
Because I tried some options but it seems none of them worked...
BTW: getting results seems quite slow in my opinion. Does it depend on ovirt-shell itself or something I can tune in PotgreSQL RDBMS parameters perhaps?
the query cycle is: 0. shell -> sdk 1. sdk: http request to server 2. api: unmarshal from xml2java 3. api 4. engine 5. db 6. engine 7. api 8. api: marshall to xml 9. sdk - unmarshall xml2python 10. cli foramt 11. shell i did profiling and results where good, unless server was really busy, in your case i believe latency caused by client side filtering, i.e --kwargs, you should use it only on collections where oVirt search not available (no --query option), or it doesn't answer your needs. --kwargs is very useful feature, but not efficient as in order to perform filtering on collection, its should get all collection members first.
Gianluca _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
-- Michael Pasternak RedHat, ENG-Virtualization R&D
participants (2)
-
Gianluca Cecchi
-
Michael Pasternak