Bug 1636331 - Return error when attempting to update disk from /api/disks/{disk_id}
Summary: Return error when attempting to update disk from /api/disks/{disk_id}
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 4.2.6
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ovirt-4.3.2
: 4.3.0
Assignee: Fedor Gavrilov
QA Contact: samuel macko
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-10-05 07:00 UTC by Germano Veit Michel
Modified: 2022-03-13 15:41 UTC (History)
11 users (show)

Fixed In Version: ovirt-engine-4.3.2.1
Doc Type: Bug Fix
Doc Text:
Previously, trying to update a disk attribute using the /api/disks/{disk_id} API failed without an error. The current release fixes this issue.
Clone Of:
Environment:
Last Closed: 2019-05-08 12:38:40 UTC
oVirt Team: Storage
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3910111 0 Learn more None RHV: How to update Disks via API v4? 2019-02-14 03:16:52 UTC
Red Hat Product Errata RHEA-2019:1085 0 None None None 2019-05-08 12:38:53 UTC
oVirt gerrit 97825 0 'None' MERGED restapi: return 409 when attempting to update disk 2021-02-01 13:02:12 UTC

Description Germano Veit Michel 2018-10-05 07:00:12 UTC
Description of problem:

Trying to update a disk attribute via API does not work.

# curl \
--cacert '/etc/pki/ovirt-engine/ca.pem' \
--user 'admin@internal:redhat' \
--request PUT \
--header 'Version: 4' \
--header 'Content-Type: application/xml' \
--header 'Accept: application/xml' \
--data '
<disk>
    <propagate_errors>true</propagate_errors>
</disk>
' \
https://rhvm.rhvlab/ovirt-engine/api/disks/4d380f88-9f64-4267-bdae-2ebeb5920eaf

No error is returned, but the attribute is still set to the old value. All other attributes seem to have the same behavior.

Also, if going via diskattachments, then it works. But some properties are by disk (i.e. propagate_errors) so it makes more sense to PUT to disks instead of diskattachments.

Version-Release number of selected component (if applicable):
ovirt-engine-4.2.6.4-1.el7.noarch
ovirt-engine-restapi-4.2.6.4-1.el7.noarch

How reproducible:
100%

Steps to Reproduce:
As above

Actual results:
Disk attribute not updated

Expected results:
Disk attribute updated

Comment 1 Ori Liel 2018-10-08 13:03:22 UTC
Allowing update in diskattachment context and not in disk context was a design decision, see discussion here:

https://bugzilla.redhat.com/show_bug.cgi?id=1429437

I actually agree with Juan's comment #6 in the discussion:

https://bugzilla.redhat.com/show_bug.cgi?id=1429437#c6

but he gave the final say to the storage team and that's how it stayed

There is one exception by the way, qcow2, which is updated at the disk level, see: 

https://gerrit.ovirt.org/#/c/67849/

In my opinion the approach of managing general disk properties should be done at the disk level, and managing properties of the relationship VM<-->Disk should be done at the disk-attachemnt level, as Juan said. So I agree that this is a bug but I would like to hear the input of Storage team

Comment 2 Tal Nisan 2018-10-22 08:28:09 UTC
Yes, this was a design decision, same as in the Webadmin in which you cannot edit a disk via the disks main tab but only through the disks sub tab of a VM.
Disk properties are editable from within
/vms/{vm_id}/diskattachments/{disk_attachment_id}

Comment 3 Germano Veit Michel 2018-10-22 22:19:19 UTC
(In reply to Tal Nisan from comment #2)
> Yes, this was a design decision, same as in the Webadmin in which you cannot
> edit a disk via the disks main tab but only through the disks sub tab of a
> VM.
> Disk properties are editable from within
> /vms/{vm_id}/diskattachments/{disk_attachment_id}

Hi Tal,

Its fine if this is a design decision. But could we change this to a RFE to at least make the engine return an error/message instead of OK? Accepting the PUT, returning OK and doing nothing is not user friendly. Makes people waste time debugging and eventually raise more bugs like this one.

Comment 4 Tal Nisan 2018-10-28 14:01:59 UTC
Returning an error message (not allowed maybe?) makes perfect sense to me, Ondra what do you think?

Comment 5 Ondra Machacek 2018-12-18 14:30:34 UTC
Sorry missed the needinfo. Yes it makes sense to return an error. I would use HTTP 409.

Comment 7 Sandro Bonazzola 2019-01-28 09:39:55 UTC
This bug has not been marked as blocker for oVirt 4.3.0.
Since we are releasing it tomorrow, January 29th, this bug has been re-targeted to 4.3.1.

Comment 9 Sandro Bonazzola 2019-03-05 10:45:14 UTC
all referenced patches are merged, can you please check this bug status? Should it be in modified?

Comment 11 samuel macko 2019-03-20 21:19:37 UTC
Verified on ovirt-engine-4.3.2.1-0.1.el7.noarch.
Engine now returns error:
<fault>
    <detail>Updating disk attributes other than QCOW version is permitted only for disk-attachments, which reside under VMs.</detail>
    <reason>Operation Failed</reason>
</fault>

Comment 13 errata-xmlrpc 2019-05-08 12:38:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHEA-2019:1085

Comment 14 Daniel Gur 2019-08-28 13:13:39 UTC
sync2jira

Comment 15 Daniel Gur 2019-08-28 13:17:53 UTC
sync2jira

Comment 16 tmeyer 2020-08-28 22:33:26 UTC
I have been unable to use this to update a disk quota. The quota attribute is located in /disks, not /disk_attachments.

Example:
curl -v -u "user@server:password" -H "Content-type: application/xml" -data "<disk_attachment><quota id='ccc'/></disk_attachment>" 'https://blowfish/ovirt-engine/api/vms/xxx/diskattachments/bbb'

This returns invalid while attempting to update the disk directly returns the error message:
"<fault>
    <detail>Updating disk attributes other than QCOW version is permitted only for disk-attachments, which reside under VMs.</detail>
    <reason>Operation Failed</reason>
</fault>"

Is disk quota updating via the API no longer supported?


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