Bug 1461384 - Non intuitive behavior when setting both 'size' and 'provisioned_size' values to a Disk object in V3 API
Summary: Non intuitive behavior when setting both 'size' and 'provisioned_size' values...
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ovirt-4.2.0
: ---
Assignee: Juan Hernández
QA Contact: Pavel Stehlik
Allon Mureinik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-14 11:09 UTC by shani
Modified: 2017-06-15 10:23 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-15 10:23:58 UTC
oVirt Team: Storage
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)
Example of setting both 'size' and 'provisioned_size' values to a Disk object in V3 API (814 bytes, text/plain)
2017-06-14 11:09 UTC, shani
no flags Details

Description shani 2017-06-14 11:09:03 UTC
Created attachment 1287617 [details]
Example of setting both 'size' and 'provisioned_size' values to a Disk object in V3 API

Description of problem:
When assigning both 'size' and 'provisioned_size' values to a 'params.Disk' object using sdk (order doesn't matter), the disk's size as it appears on the UI is determined by the 'provisioned_size', without showing any error message or other feedback to the user.

Version-Release number of selected component (if applicable):
Reproduced for 4.2 version, although according to the code, was probably present before that.

How reproducible:
100%

Steps to Reproduce:
1. Create a disk using the REST API V3 or SDK with both 'size' and 'provisioned_size' parameters.

Actual results:
The disk's size is determined by the 'provisioned_size' parameter, without any errors.

Expected results:
Error / notification

Additional info:
-

Comment 1 Allon Mureinik 2017-06-14 11:44:44 UTC
Looking at V3DiskInAdapter, size is handled first and provisioned_size is handled later, both calling the result's setSize.

Juan - what's the right approach here?
Throw and exception if both size and provisioned_size are set?
Document this behavior? If so, where?

Comment 2 Juan Hernández 2017-06-14 17:11:05 UTC
That logic is there to preserve backwards compatibility. When the 'provisioned_size' attribute was introduced the 'size' attribute couldn't be removed, because that would have broken backwards compatibility for applications that were already sending it. We can't fail if both are sent, because a common practice is to do updates retrieving the object, modifying it, and sending it back to do the update. That will send both 'size' and 'provisioned_size' even when updating something else. That behaviour is the default in version 3 of the SDKs, for example.

We don't have documentation for version 3 of the API, so the only possible place to document this is the documentation of version 4 of the API. We could add a note to the description of 'provisioned_size' explaining this, although we don't usually explain V3 behaviours in V4 behaviours. This BZ may be the best place to explain it. In that case it is already done.

Comment 3 Allon Mureinik 2017-06-15 10:23:58 UTC
Thanks for the extensive explanation Juan!
I agree, let's close this BZ.


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