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

Omer Frenkel ofrenkel at redhat.com
Mon May 27 14:02:37 UTC 2013


----- Original Message -----

> From: "Edgar" <shweng at 163.com>
> To: engine-devel at 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 at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20130527/f6c8cb01/attachment-0001.html>


More information about the Devel mailing list