Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1406064

Summary: The elements of list disk.storage_domains don't have links
Product: [oVirt] ovirt-engine Reporter: Juan Hernández <juan.hernandez>
Component: RestAPIAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Aleksei Slaikovskii <aslaikov>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.0.6.3CC: bodnopoz, bugs, gklein, juan.hernandez, mgoldboi, mperina
Target Milestone: ovirt-4.1.0-rcFlags: rule-engine: ovirt-4.1+
mgoldboi: planning_ack+
juan.hernandez: devel_ack+
pstehlik: testing_ack+
Target Release: 4.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-01 14:50:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Juan Hernández 2016-12-19 15:54:41 UTC
When the representation of a disk is retrieved using the API the following XML document is returned:

  <disk href="/ovirt-engine/api/disks/123" id="123">
    ...
    <storage_domains>
      <storage_domain id="456"/>
    </storage_domains>
  </disk>

In that XML document the 'href' attribute of the storage domain is missing. This means that the user of the API as to calculate the 'href' itself in order to retrieve the details of the storage domain. This is specially problematic for developers using the 'follow_link' method of the SDKs, as they won't be able to use it. For example, when the 'href' attribute is populated correctly, the code to retrieve the storage domain with the Ruby SDI is as simple as this:

   # Retrieve the disk:
   disk = ...

   # Retrieve the details of the storage domain:
   sd = connection.follow_link(disk.storage_domains.first)

But if the 'href' isn't populated then the code needs to be like this:

  # Retrieve the disk:
  disk = ...

  # Find the service that manages the storage domain:
  sd = disk.storage_domains.first
  sd_service = connection.system_service.storage_domains_service.storage_domain_service(sd.id)

  # Retrieve the storage domain:
  sd = sd_service.get()

The server should be fixed so that the 'href' attribute is populated correctly.

Comment 1 Sandro Bonazzola 2017-01-25 07:56:23 UTC
4.0.6 has been the last oVirt 4.0 release, please re-target this bug.

Comment 2 Aleksei Slaikovskii 2017-01-31 18:17:46 UTC
Verified on ovirt-engine-sdk-python (4.1.0)

>>> connection = ...
>>> disk = ...
>>> sd = connection.follow_link(disk.storage_domains[0])
<ovirtsdk4.types.StorageDomain object at 0x7f96b3ac8748>
>>> sd.name
'nfs_0'