Bug 1132247

Summary: [GUI over REST API gaps] missing GetNumberOfActiveVmsInVdsGroupByVdsGroupId
Product: Red Hat Enterprise Virtualization Manager Reporter: Einav Cohen <ecohen>
Component: ovirt-engineAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: sefi litmanovich <slitmano>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.5.0CC: bazulay, gklein, istein, juan.hernandez, lsurette, oramraz, rbalakri, Rhev-m-bugs, srevivo, ykaul
Target Milestone: ovirt-3.6.0-rc   
Target Release: 3.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-20 01:10:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1132506    

Description Einav Cohen 2014-08-21 01:51:12 UTC
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").

Comment 1 Juan Hernández 2014-10-21 18:45:22 UTC
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.

Comment 2 sefi litmanovich 2015-06-01 16:22:12 UTC
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>