Bug 1387951
| Summary: | Disk Issues via API and SDK | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [oVirt] ovirt-engine-sdk-ruby | Reporter: | marcus young <3vilpenguin> | ||||
| Component: | Documentation | Assignee: | Juan Hernández <juan.hernandez> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Aleksei Slaikovskii <aslaikov> | ||||
| Severity: | low | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 4.0.2 | CC: | bugs | ||||
| Target Milestone: | ovirt-4.1.0-alpha | Flags: | rule-engine:
ovirt-4.1+
rule-engine: planning_ack+ juan.hernandez: devel_ack+ pstehlik: testing_ack+ |
||||
| Target Release: | 4.1.0.alpha2 | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | 4.1.0.alpha2 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2017-02-01 14:57:24 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: | |||||||
| Attachments: |
|
||||||
|
Description
marcus young
2016-10-24 02:03:13 UTC
The expected value for the disk status is 'nil' because when retrieving a list of disk attachments the disk is just a _link_, not the actual data. Fore example:
<disk_attachments>
<disk_attachment href="/ovirt-engine/api/vms/123/diskattachments/456" id="456">
<active>true</active>
<bootable>true</bootable>
<interface>virtio</interface>
<disk href="/ovirt-engine/api/disks/789" id="789"/>
<vm href="/ovirt-engine/api/vms/123" id="123"/>
</disk_attachment>
</disk_attachments>
To retrieve the actual disk data you have to perform another request, to the '/ovirt-engine/api/disk/789' URL in this case. With the Ruby SDK this is simplified using the 'follow_link' method of the connection:
http://www.rubydoc.info/gems/ovirt-engine-sdk/OvirtSDK4/Connection#follow_link-instance_method
For example:
disk_attachments = disk_attachments_service.list
disk_attachments.each do |disk_attachment|
# This call to `follow_link` will take the `href` attribute from the
# disk attachment and perform a GET request of that URL, and will
# return the completely populated object:
disk = connection.follow_link(disk_attachment.disk)
# Then you can use all the attributes of the disk object:
puts "name: #{disk.name}"
puts "id: #{disk.id}"
puts "status: #{disk.status}"
puts "provisioned_size: #{disk.provisioned_size}"
end
I am trying to clarify that in the 'list_vm_disk' example included in the SDK:
Clarify that DiskAttachment.disk is only a link
https://gerrit.ovirt.org/65674
Regarding the /vm/{vm:id}/disk URL, it has been removed in version 4 of the API. The example that you mention talks about version 3 of the API.
As this is the expected behavior and there is a way to get the disk details, using the 'follow_links' method, I am lowering the severity and moving the bug to the documentation component.
The fix for this issue should be included in oVirt 4.1.0 beta 1 released on December 1st. If not included please move back to modified. Verified on ovirt-engine-sdk version 4.1.0.alpha3. |