Bug 863183 - [RFE] [RHEVM-API] Expose size of all collections and sub-collections.
[RFE] [RHEVM-API] Expose size of all collections and sub-collections.
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi (Show other bugs)
3.1.0
Unspecified Unspecified
low Severity low
: ---
: 3.5.0
Assigned To: Ravi Nori
Shai Revivo
infra
: FutureFeature, Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-04 11:50 EDT by Stephen Gordon
Modified: 2016-02-10 14:43 EST (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-03-18 04:56:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Stephen Gordon 2012-10-04 11:50:46 EDT
Description of problem:

Currently, the only way to determine the size of a collection or sub-collection that is not included in the api summary information (which only contains vms, hosts, users, and storage_domains) is to iterate through all pages of the list method like so:

dc_list = []
dc_page_index = 1 
dc_page_current = api.datacenters.list(query="page %s" % dc_page_index)
while(len(dc_page_current) != 0): 
    dc_list = dc_list + dc_page_current
    dc_page_index = dc_page_index + 1 
    dc_page_current = api.datacenters.list(query="page %s" % dc_page_index)
print len(dc_list)

The REST API and SDK should ideally expose the size of all collections more directly.
Comment 1 Michael Pasternak 2012-10-09 09:18:16 EDT
1. i'm not sure if it works for RESTfull api

2. i did not convinced that knowing collection size ahead of
   paging/looping gives any benefit to the client.

what i do think, that client should be able retrieving entire collection,
using max=-1 or search dialect.
Comment 2 Stephen Gordon 2012-10-09 10:01:25 EDT
(In reply to comment #1)
> 2. i did not convinced that knowing collection size ahead of
>    paging/looping gives any benefit to the client.

This isn't the only reason you might want the size though. In my scenario I was working on an overview dashboard application with summary totals. The problem is that to generate those summary totals you effectively have to page through every record in every collection you are interested in - just to determine the size.

> what i do think, that client should be able retrieving entire collection,
> using max=-1 or search dialect.

I think, based on the discussions I lurked on in #rhev on Freenode, this is what many users/developers expect. Obviously in the documentation we would need to point out the performance risks of using this operation for large environments.
Comment 10 Juan Hernández 2014-03-18 04:56:16 EDT
After analyzing the complexity required to implement this (specially for subcollections implemented using queries), the cost in terms of performance and the benefit for the user we have came to the conclussion that it isn't worth implementing it.

Note You need to log in before you can comment on or make changes to this bug.