Re: [Engine-devel] How to get the number of all running VMs

2013-05-27 Thread Omer Frenkel
- Original Message -

 From: Edgar shw...@163.com
 To: engine-devel@ovirt.org
 Sent: Monday, May 27, 2013 4:35:42 PM
 Subject: [Engine-devel] How to get the number of all running VMs

 Hi All,
 I need to get the number of All running VMs of the oVirt-engine.
 My thought is first get all hosts with up status and then traverse each
 host and count the
 VM with state Running .

 Does this method feasible,and is there any easier way to count the running
 VMs of oVirt-engine?

 Best Regards

you can use the webadmin, but not sure there is an easy way to see total count 
if there are more than one pages of results, 
just enter in the search: 
Vms: status != down and status != imagelocked and status != suspended 

you can use get the same with rest api: 
http://localhost:8700/api/vms?search=%22status%20!=%20down%20and%20status%20!=%20imagelocked%20and%20status%20!=%20suspended%22
 
and parse the result 

or by using the db: 
select count(*) from vm_dynamic where status not in (0,15,13); 

 ___
 Engine-devel mailing list
 Engine-devel@ovirt.org
 http://lists.ovirt.org/mailman/listinfo/engine-devel
___
Engine-devel mailing list
Engine-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-devel


Re: [Engine-devel] How to get the number of all running VMs

2013-05-27 Thread Michael Pasternak
On 05/27/2013 04:35 PM, Edgar wrote:
 Hi All,
  I need to get the number of All running VMs of the oVirt-engine.
  My thought is first get all hosts with up status and then traverse each 
 host and count the 
  VM with state Running .

you can use ovirt-shell (3.3+) for this, just run 'summary' command:

[oVirt shell (connected)]# summary

hosts-active  : 0
hosts-total   : 0
storage_domains-active: 0
storage_domains-total : 0
users-active  : 1
users-total   : 1
vms-active: 0
vms-total : 3

 
   Does this method feasible,and is there any easier way to count the running 
 VMs of oVirt-engine?
 
  Best Regards
 
   
 
  
 
 
 
 
 ___
 Engine-devel mailing list
 Engine-devel@ovirt.org
 http://lists.ovirt.org/mailman/listinfo/engine-devel
 


-- 

Michael Pasternak
RedHat, ENG-Virtualization RD
___
Engine-devel mailing list
Engine-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-devel