Bug 1132499 - [GUI over REST API gaps] missing GetStorageDomainListById
Summary: [GUI over REST API gaps] missing GetStorageDomainListById
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ovirt-3.6.0-rc
: 3.6.0
Assignee: Juan Hernández
QA Contact: Ori Gofen
URL:
Whiteboard:
Depends On:
Blocks: 1132506
TreeView+ depends on / blocked
 
Reported: 2014-08-21 12:58 UTC by Einav Cohen
Modified: 2016-05-26 01:52 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Storage
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 35406 0 master MERGED restapi: Support multiple links to DC from SD Never

Description Einav Cohen 2014-08-21 12:58:43 UTC
we are missing a way to invoke the GetStorageDomainListById query in the REST API. 
this query is being used in the GUI in the 'Storage -> Data Centers' sub-tab. 

[AFAIR, this query returns a list of storage domains, in which each item is the exact same storage domain, in the context (status, etc.) of the data-center to which this storage domain is attached]

Comment 1 Allon Mureinik 2014-08-24 07:24:54 UTC
From a quick look, this query seems to always return 0 or 1 storage domains, depending if the domain with the given ID is attached to a pool or not.
I think with a bit of tinkering it can be dropped completely and replaced with calls to GetStorageDomainById.

Tal/Daniel - can you confirm?

Comment 2 Daniel Erez 2014-08-24 07:43:09 UTC
(In reply to Allon Mureinik from comment #1)
> From a quick look, this query seems to always return 0 or 1 storage domains,
> depending if the domain with the given ID is attached to a pool or not.
> I think with a bit of tinkering it can be dropped completely and replaced
> with calls to GetStorageDomainById.
> 
> Tal/Daniel - can you confirm?

Actually, the query can return multiple results - in case of an ISO domain that is attached to multiple DCs (used for 'storage -> data-centers' sub-tab).

Comment 3 Juan Hernández 2014-11-20 16:03:14 UTC
I think this can be solved adding to the Storage Domain entities a list of links to the Data Centers they are attached to. For example:

  GET /storagedomains/{storagedomain:id}
  <storage_domain id="..." href="...">
    <name>mydata</name>
    <data_centers>
      <data_center id="..." href="..."/>
      <data_center id="..." href="..."/>
      ...
    </data_centers>
  </storage_domain>

With this information the client (the GUI in this case) can find the identifiers of the data centers and then retrieve them using an additional call.

Note that we already have a this link, but only for one Data Center, and only in the /datacenters/{datacenter:id}/storagedomains collection. That must be preserved for backwards compatibility.

Comment 4 Allon Mureinik 2015-03-29 18:27:48 UTC
Juan, can you please provide some doctext for this BZ?

Comment 5 Ori Gofen 2015-05-07 12:30:46 UTC
Juan, can you please provide steps to reproduce?

Comment 6 Juan Hernández 2015-05-07 13:27:54 UTC
The steps to reproduce are the following:

1. Create at least two data centers, each with at least one storage domain and hone host.

2. Create a ISO storage domain and attach it to the previously created data centers.

3. Request the representation of the storage domain to the RESTAPI using the top level /storagedomains collection, for example using a script like the following:

  #!/bin/sh -ex

  url="https://engine.example.com/ovirt-engine/api"
  user="admin@internal"
  password="***"

  curl \
  --insecure \
  --user "${user}:${password}" \
  --header "Accept: application/xml" \
  "${url}/storagedomains/the_id_of_the_iso_domain"

The result should contain a "data_centers" element, and it should contain references to the two data centers it is attached to:

  <data_centers>
    <data_center id="the_id_of_the_first_data_center"/>
    <data_center id="the_id_of_the_second_data_center"/>
  </data_centers>

(This is enough to verify that the bug is solved, but to verify that there isn't a backwards compatibility issue we should also check that the old single "data_center" element is also available when requesting the storage domain via the /datacenter/{datacenter:id}/storagedomains subcollection.)

4. Request the representation of the ISO domain using the /datacenter/{datacenter:id}/storagedomains subcollection:

  #!/bin/sh -ex

  url="https://engine.example.com/ovirt-engine/api"
  user="admin@internal"
  password="***"

  curl \
  --insecure \
  --user "${user}:${password}" \
  --header "Accept: application/xml" \
  "${url}/datacenters/the_id_of_the_data_center/storagedomains/the_id_of_the_iso_storage_domain"

The result should contain the new "data_centers" element and also the old "data_center" element:

  <!-- This is the old single element: -->
  <data_center id="b8953853-4771-4768-b83f-1216bc6bf934"/>

  <!-- This is the new multiple element: -->
  <data_centers>
    <data_center id="b8953853-4771-4768-b83f-1216bc6bf934"/>
    <data_center id="e4c1c8cb-c539-42bb-9038-9c1487bf5cd8"/>
  </data_centers>

Comment 7 Ori Gofen 2015-05-10 11:04:52 UTC
verified on 3.6 master

Comment 10 Allon Mureinik 2016-03-10 10:43:48 UTC
RHEV 3.6.0 has been released, setting status to CLOSED CURRENTRELEASE

Comment 11 Allon Mureinik 2016-03-10 10:47:52 UTC
RHEV 3.6.0 has been released, setting status to CLOSED CURRENTRELEASE

Comment 12 Allon Mureinik 2016-03-10 12:04:24 UTC
RHEV 3.6.0 has been released, setting status to CLOSED CURRENTRELEASE


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