As a side note, The current the v4.3 API docs shows that the only field of
a disk that can be update is `qcow_version` (
http://ovirt.github.io/ovirt-engine-api-model/4.3/#services/disk/methods/update).
While all the properties, including the inner disk properties, are
supported when updating a disk-attachment (
http://ovirt.github.io/ovirt-engine-api-model/4.3/#services/disk_attachment/methods/update
).

So if I want to extend the disk size or some other changes, I need to use
its disk-attachment representation. However, the v4.3 API does not support
to fetch all the relevant disk-attachments by a disk id.

In my view, maybe there should have a interconnection of the disk,
disk-attachment and vm.

Thanks.


On Fri, Jun 1, 2018 at 2:49 PM, Joey Ma <[email protected]> wrote:

>
>
> On Fri, Jun 1, 2018 at 1:48 PM, Ondra Machacek <[email protected]>
> wrote:
>
>> Looking the API, the Disk type has element 'vms', but we don't feed it
>> with data:
>>
>>
>> https://github.com/oVirt/ovirt-engine-api-model/blob/master/
>> src/main/java/types/Device.java#L50
>>
>> I can fix the API so it returns it. So feel free to open a bug if you
>> need it.
>>
>
> OK. Thanks.
>
>
>
>> But maybe, can you describe your exact use case? You user just input
>> disk 'id' and you are suppose to return the VM which it's attached to?
>>
>
> Take 2 cases for examples:
>
> 1. Updating the attributes of a disk needs to also update the
> corresponding disk-attachment, which requires the vm id to initialize the
> VMService. The code shows as blow:
>
> `connnection.SystemService().VMsService().VMService(vmid).
> DiskAttachmentsService().Update()`.
>
>
> 2. Deleting a disk needs to make sure all the VMs it's attached to have
> been powered down (if not, we could directly power down them). Then we
> could detach the disk for each VM and removes the disk finally.
>
>
>
>> If you need to know only if it's attached 'true/false', you can use
>>
>>   /api/disks?search=number_of_vms=1
>>
>> On 06/01/2018 04:57 AM, Joey Ma wrote:
>>
>>> Hi Ondra,
>>>
>>> I tried your URL but it not worked. I want to retrieve all the attached
>>> vms by a disk, so I cloud not provide a specified vm name for searching.
>>> Also tried with https://fqdn/ovirt-engine/api/vms?search= <
>>> https://fqdn/ovirt-engine/api/disks?search=vm_names=myvmname>_disk=DISKNAME_,
>>> unfortunately the `disk` parameter is not supported.
>>>
>>>
>>> Put it differently, how could I get the disk list by rest API as same as
>>> shown by visiting admin portal at https://fqdn/ovirt-engine/weba
>>> dmin/?#disks, which indicates the attached vm name for each disk.
>>>
>>>
>>> <https://10.1.111.222/ovirt-engine/webadmin/?locale=en_US#disks>
>>>
>>>
>>> On Fri, Jun 1, 2018 at 8:51 AM, Joey Ma <[email protected] <mailto:
>>> [email protected]>> wrote:
>>>
>>>     OK, got it. Search is a powerful solution. Thank you very much.
>>>
>>>     On Thu, May 31, 2018 at 6:49 PM, Ondra Machacek <[email protected]
>>>     <mailto:[email protected]>> wrote:
>>>
>>>         On 05/31/2018 09:28 AM, iterjpnic  wrote:
>>>
>>>             Hi all,
>>>
>>>             I use oVirt engine API v4.2 for implementing terraform oVirt
>>>             provider. And I want to check if a Disk has been attached to
>>>             a VM, so I need to find all vms attached by this disk.
>>>             But after I checked the GET-Response data from the
>>>             "/ovirt-engine/api/disks/<disk-id>" rest url, there has no
>>>             disk-attachment/vm related properties or links. I could get
>>>             a trade-off, by the following steps:
>>>             1. getting all vms
>>>             2. get all disk-attachments of each vm
>>>             3. check if the given disk id equals to the `disk` property
>>>             of each disk-attachment`
>>>             4. If equals, append the vm to result list
>>>
>>>             Is there any simpler and smarter way to get this? Thanks.
>>>
>>>
>>>         Hi, you can use following:
>>>
>>>         https://fqdn/ovirt-engine/api/disks?search=vm_names=myvmname
>>>         <https://fqdn/ovirt-engine/api/disks?search=vm_names=myvmname>
>>>
>>>             _______________________________________________
>>>             Users mailing list -- [email protected] <mailto:
>>> [email protected]>
>>>             To unsubscribe send an email to [email protected]
>>>             <mailto:[email protected]>
>>>             Privacy Statement:
>>>             https://www.ovirt.org/site/privacy-policy/
>>>             <https://www.ovirt.org/site/privacy-policy/>
>>>             oVirt Code of Conduct:
>>>             https://www.ovirt.org/community/about/community-guidelines/
>>>             <https://www.ovirt.org/community/about/community-guidelines/
>>> >
>>>             List Archives:
>>>             https://lists.ovirt.org/archives/list/[email protected]/messag
>>> e/6LVOIVEUUO7PXVV36GH3V6GSURQV4ALO/
>>>             <https://lists.ovirt.org/archives/list/[email protected]/messa
>>> ge/6LVOIVEUUO7PXVV36GH3V6GSURQV4ALO/>
>>>
>>>
>>>
>>>
>
_______________________________________________
Users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/[email protected]/message/WS6P4I57CZ5VR3JAJ3FFYAASVAD64SXM/

Reply via email to