Bug 863183 - [RFE] [RHEVM-API] Expose size of all collections and sub-collections.
Summary: [RFE] [RHEVM-API] Expose size of all collections and sub-collections.
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.1.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: 3.5.0
Assignee: Ravi Nori
QA Contact: Shai Revivo
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-04 15:50 UTC by Stephen Gordon
Modified: 2016-02-10 19:43 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-03-18 08:56:16 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Stephen Gordon 2012-10-04 15:50:46 UTC
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 13:18:16 UTC
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 14:01:25 UTC
(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 08:56:16 UTC
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.