----- 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

Reply via email to