Bug 1122125

Summary: [RFE] RESTAPI: need to return total count of items (ignoring page number/size) for any given search query.
Product: [Retired] oVirt Reporter: Einav Cohen <ecohen>
Component: ovirt-engine-apiAssignee: Ori Liel <oliel>
Status: CLOSED WONTFIX QA Contact: Pavel Stehlik <pstehlik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.5CC: bazulay, bugs, ecohen, gchaplik, gklein, iheim, juan.hernandez, mgoldboi, pnovotny, pstehlik, rbalakri, yeylon, ykaul
Target Milestone: ---Keywords: FutureFeature
Target Release: 3.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: 1114692
: 1139353 (view as bug list) Environment:
Last Closed: 2015-03-23 10:24:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 1139353    
Bug Blocks: 1114692    

Description Einav Cohen 2014-07-22 15:12:46 UTC
+++ This bug was initially created as a clone of Bug #1114692 +++

in order to display in the GUI total numbers of items for every paged grid (at the moment - main grids):

need new queries that will return the total count of items for a certain query (ignoring the requested page number/size), or that the existing search queries will return, as part of the result, *also* the number of items for that query (again, ignoring the requested page number/size).

Comment 1 Juan Hernández 2014-09-08 17:53:03 UTC
The XML schema used by the RESTAPI already has a "total" element associated to collections that could be used for this purpose:

  <vms>
    <vm id="...">...</vm>
    <vm id="...">...</vm>
    ...
    <total>123456</total>
  </vms>

How the backend will return the total size is to be decided by the backend maintainers. My suggestion is that queries be modified to return an object containing the list of results and the total size, instead of the plain list that they return today. The RESTAPI can then check the type of the returned object and populate the "total" field if available. This allows for a once off implementation in the RESTAPI and for a gradual implementation of the feature in the backend.

I have opened bug 1139353 to track the required changes in the backend.

Comment 2 Juan Hernández 2015-03-23 10:24:08 UTC
Obtaining the total number of items is unfeasible due to performance degradation.