we are missing a way to invoke the GetNumberOfActiveVmsInVdsGroupByVdsGroupId query in the rest api. the problematic issue here is for the rest-api to return a number, rather than a resource. we can work-around this particular issue by retrieving the relevant VMs and count them, but this may result in a huge response traffic (e.g. 1000 VMs) just for ultimately receiving a number (e.g. "1000").
Retrieving the VMs active of a particular cluster is already, possible using a query: url="https://ovirt.example.com/ovirt-engine/api" user="admin@internal" password="******" curl \ --verbose \ --insecure \ --request GET \ --user "${user}:${password}" \ --header "Accept: application/xml" \ "${url}/vms?search=status%3Dup%20and%20cluster%3Dmycluster" Retrieving only the size will be possible using the new "size" attribute that will be introduced to fix bug 1132249. So what remains to be done is adding support for this attribute to the top level VMs collection.
Verified with ovirt-engine-3.6.0-0.0.master.20150519172219.git9a2e2b3.el6.noarch Have a setup with a cluster + host + 7 vms - 1 up 6 down. 1. url="https://ovirt.example.com/ovirt-engine/api" user="admin@internal" password="******" curl \ --verbose \ --insecure \ --request GET \ --user "${user}:${password}" \ --header "Accept: application/xml" \ "${url}/vms;details=+size" response: <vms> <size>7</size> <vm id="..." href="..."> ... </vm> ... </vms> 2. url="https://ovirt.example.com/ovirt-engine/api" user="admin@internal" password="******" curl \ --verbose \ --insecure \ --request GET \ --user "${user}:${password}" \ --header "Accept: application/xml" \ "${url}/vms;details=+size?search=status%3Dup%20and%20cluster%3Dmycluster" response: <vms> <size>1</size> <vm id="..." href="..."> ... </vm> ... </vms>