Bug 1132503

Summary: [GUI over REST API gaps] missing GetStorageDomainsByImageId
Product: Red Hat Enterprise Virtualization Manager Reporter: Einav Cohen <ecohen>
Component: ovirt-engine-restapiAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED NOTABUG QA Contact: Aharon Canan <acanan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.5.0CC: amureini, bazulay, derez, ecohen, gklein, iheim, juan.hernandez, lsurette, oramraz, rbalakri, Rhev-m-bugs, scohen, tnisan, yeylon, ykaul
Target Milestone: ovirt-3.6.3   
Target Release: 3.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-31 09:17:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1132506    

Description Einav Cohen 2014-08-21 13:10:55 UTC
we are missing a way to invoke the GetStorageDomainsByImageId query in the REST API. 
this query is being used in the GUI in the 'Disks -> Storage' sub-tab. 

[this query returns the list of storage domains on which a specified image resides. this list can contain more than 1 item in case the specified image is a template image (as template images can be cloned across multiple storage domains]

Comment 1 Juan Hernández 2014-10-29 12:01:29 UTC
This is already available for disks, as each disk has a reference to the storage domain where it resides, and there can be only one in this case:

  #!/bin/sh -ex

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

  curl \
  --verbose \
  --insecure \
  --request GET \
  --user "${user}:${password}" \
  --header "Accept: application/xml" \
  "${url}/disks/9409b1fa-f653-498b-97b8-f4bb4fb0e4a3"

  <disk id="...">
    <name>mydisk</name>
    <alias>mydisk</name>
    <storage_domains>
      <storage_domain id="23bae86f-0da9-4a1b-a0a1-f13c6d503984"/>
    </storage_domains>
    ...
  </disk>

To fix this bug what remains to be done is to add this same "storage_domains" section to templates.

Comment 2 Juan Hernández 2014-10-31 09:17:14 UTC
The /templates/{template:id}/disks collection also contains the references to the storage domains, so no modification is needed there.