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

Bug 1585572

Summary: Document API for fetch disks extended information
Product: [oVirt] ovirt-engine Reporter: Joey Ma <majunjiev>
Component: RestAPIAssignee: shani <sleviim>
Status: CLOSED CURRENTRELEASE QA Contact: Radim Hrazdil <rhrazdil>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.3.0CC: arshpreet218, bugs, lsvaty, omachace, tnisan, ylavi
Target Milestone: ovirt-4.2.5Keywords: Reopened
Target Release: ---Flags: rule-engine: ovirt-4.2+
rule-engine: ovirt-4.3+
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: 2018-07-31 15:25:02 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:

Description Joey Ma 2018-06-04 06:50:12 UTC
Description of problem:

Before deleting a disk, I need to inform users that which vm(s) the disk is attached to. But after referring to the doc (http://ovirt.github.io/ovirt-engine-api-model/4.3), maybe there has no way to achieve that.

Discussions in ovirt-user mail list is here: https://lists.ovirt.org/archives/list/users@ovirt.org/thread/6LVOIVEUUO7PXVV36GH3V6GSURQV4ALO/#6LVOIVEUUO7PXVV36GH3V6GSURQV4ALO


Version-Release number of selected component (if applicable):

4.3.0

How reproducible:
100%


Actual results:

No simple method to get vms which a disk is attached to.

Expected results:

The method for getting a disk (http://ovirt.github.io/ovirt-engine-api-model/4.3/#services/disk/methods/get) should return the vms it's attached to.


Additional info:

Comment 1 Tal Nisan 2018-06-04 15:14:54 UTC
Hi Joey,
The VMs information is not displayed for the disks by default as it requires more queries to be executed that might pose a performance hit if run on a very big amount of disks.
You can have the info on VMs attached to a disk when GETing a disk via:

/ovirt-engine/api/disks/{disk-id}

And specifying the header name "All-Content" wit the value "true", this will populate the disk returned with the VMs it's attached to:

<disk>
    ...
    <vms>
        <vm href="/ovirt-engine/api/vms/{vm1-id}" id="{vm1-id}"/>
        <vm href="/ovirt-engine/api/vms/{vm2-id}" id="{vm2-id}"/>
        ...
        <vm href="/ovirt-engine/api/vms/{vmn-id}" id="{vmn-id}"/>
    </vms>
    ...
</disk>

Comment 2 Joey Ma 2018-06-05 02:43:02 UTC
hi Tal,

Thanks for your advice. It works. 

However, as indicated blow, the VMs information returned doesn't seem to contain the href field.

<vms>
   <vm id="bbd4585b-1958-433b-88e3-6df9f4ee4598" />
</vms>

Is this a bug or as expected? Since lack of the href field, we could not use `connection.FollowLink` to retrieve the VM instance. Thanks.

Comment 3 Ondra Machacek 2018-06-06 06:30:56 UTC
Tal, can you please document this parameter in model documentation:

 https://github.com/oVirt/ovirt-engine-api-model/blob/master/src/main/java/services/DiskService.java#L298

Currently it isn't exposed to SDKs, as it's not there. Thanks.

Comment 4 Tal Nisan 2018-06-06 07:33:59 UTC
(In reply to Ondra Machacek from comment #3)
> Tal, can you please document this parameter in model documentation:
> 
>  https://github.com/oVirt/ovirt-engine-api-model/blob/master/src/main/java/
> services/DiskService.java#L298
> 
> Currently it isn't exposed to SDKs, as it's not there. Thanks.

This is not a parameter relevant to DiskService only, it's a general parameter relevant to all the services that can implement doPopulate, see BackendResource line #302

Comment 5 Ondra Machacek 2018-06-06 07:45:56 UTC
(In reply to Tal Nisan from comment #4)
> This is not a parameter relevant to DiskService only, it's a general
> parameter relevant to all the services that can implement doPopulate, see
> BackendResource line #302

Then we need to document those which implement it. Some are already documented, 
VmService for example:

 https://github.com/oVirt/ovirt-engine-api-model/blob/master/src/main/java/services/VmService.java#L386

Comment 6 Joey Ma 2018-06-07 23:44:28 UTC
Hi, Tal,

I just found that the IDs of DiskAttachment and relevant Disk are the same, in the mapping phrase by [1]. Is my view correct?

If so, this equivalence is extremely helpful for connecting the disk and the disk-attachment, especially when updating a disk by its relevant disk-attachment instance. Nevertheless it's missing in the API document [2]. 

Thanks.


[1]: https://github.com/oVirt/ovirt-engine/blob/68753f46f09419ddcdbb632453501273697d1a20/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/DiskAttachmentMapper.java
[2]: http://ovirt.github.io/ovirt-engine-api-model/4.3/#types/disk_attachment

Comment 7 Sandro Bonazzola 2018-06-29 16:34:53 UTC
Moving back to post since referenced patch https://gerrit.ovirt.org/#/c/92595/ is not yet merged

Comment 8 Radim Hrazdil 2018-07-09 10:47:25 UTC
Verified that allContent parameter is documented.

Comment 9 Sandro Bonazzola 2018-07-31 15:25:02 UTC
This bugzilla is included in oVirt 4.2.5 release, published on July 30th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.5 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.

Comment 10 Ondra Machacek 2018-08-28 08:21:19 UTC
*** Bug 1622359 has been marked as a duplicate of this bug. ***