Bug 1463633 - [RFE] Provide support for data aggregation when fetching entities
[RFE] Provide support for data aggregation when fetching entities
Product: ovirt-engine
Classification: oVirt
Component: RestAPI (Show other bugs)
Unspecified Unspecified
high Severity high (vote)
: ovirt-4.2.0
: 4.2.0
Assigned To: Ori Liel
samuel macko
: FutureFeature
Depends On:
Blocks: 1436206
  Show dependency treegraph
Reported: 2017-06-21 07:35 EDT by Martin Perina
Modified: 2017-09-28 05:19 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Feature: API Link Following. This features enable oVirt API users to request that the contents of some of the entity's links be returned inline, inside the requested entity. Reason: Currently when there is the need to retrieve multiple related objects from the API the only alternative is to retrieve the first one, and then, send additional requests to retrieve the related objects. For example, if you need a virtual machine and also the disks and NICs you need first to send a request like this: GET /ovirt-engine/api/vms/123 And then additional requests to get the disk attachments, the disks, and the NICs: GET /ovirt-engine/api/vms/123/diskattachments GET /ovirt-engine/api/disks/456 GET /ovirt-engine/api/disks/789 GET /ovirt-engine/api/vms/123/nics In an environment with high latency this multiplies the time required to retrieve the data. In addition it also means that multiple queries have to be sent to the database to retrieve the data. In order to improve in these two areas the new follow parameter will be introduced. This parameter will be a list of links that the server should follow and populate. For example, the previous scenario will be solved sending this request: GET /ovirt-engine/api/vms/123?follow=diskattachments.disks,nics That will return the virtual machine with the disks and the NICs embedded in the same response, thus avoiding the multiple network round-trips. The multiple database queries will be avoided only if the server is modified to retrieve that data with more efficient queries, otherwise the server will use the naive approach of calling itself to retrieve it, which won’t improve the number of queries. Result: This features saves the need from client-side scripts for following links and enables running designated queries for common scenarios (e.g: get vms+nics+disks) Deep dive presentation: https://bluejeans.com/s/Xdsmj
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
rule-engine: ovirt‑4.2+
lsvaty: testing_plan_complete-
mgoldboi: planning_ack+
mperina: devel_ack+
lsvaty: testing_ack+

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 77793 master MERGED Generate doGet, doList methods 2017-07-03 04:56 EDT
oVirt gerrit 79993 None None None 2017-08-03 12:48 EDT

  None (edit)
Description Martin Perina 2017-06-21 07:35:08 EDT
Description of problem:

Currently when someone wants to fetch resources (for example VMs) using RESTAPI, he will need additional requests to fetch also its sub resources (like NICs or disk attachments). But inside RESTAPI we already return links to those subresources, so it would not be hard to provide parameter 'follow' to define which subresources should be fetched along with main resource using single request, for example:

  GET /ovirt-engine/api/vms?follow="nics,disk_attachments"

RESTAPI will also provide default "naive" subresource fetching (which of course is not optimized for performance), but we will provide infrastructure for engine developers to easily add performance optimized implementations for common use cases (for example BZ1436206)

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:

Actual results:

Expected results:

Additional info:
Comment 3 samuel macko 2017-08-24 10:40:02 EDT
Verified in ovirt version 4.2.0-0.0.master.20170823165744.git116f435.el7.centos

Tested with:
  GET /ovirt-engine/api/vms?follow=disk_attachments,nics


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