Bug 1406064 - The elements of list disk.storage_domains don't have links
Summary: The elements of list disk.storage_domains don't have links
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.0.6.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.1.0-rc
: 4.1.0
Assignee: Juan Hernández
QA Contact: Aleksei Slaikovskii
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-19 15:54 UTC by Juan Hernández
Modified: 2017-02-01 14:50 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-02-01 14:50:22 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.1+
mgoldboi: planning_ack+
juan.hernandez: devel_ack+
pstehlik: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 68744 0 master MERGED restapi: Add links to disk storage domains 2016-12-21 09:11:37 UTC
oVirt gerrit 68874 0 ovirt-engine-4.1 MERGED restapi: Add links to disk storage domains 2016-12-21 11:22:46 UTC
oVirt gerrit 68905 0 ovirt-engine-4.0 MERGED restapi: Add links to disk storage domains 2016-12-21 14:36:26 UTC

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'


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