Bug 1461384 - Non intuitive behavior when setting both 'size' and 'provisioned_size' values to a Disk object in V3 API
Non intuitive behavior when setting both 'size' and 'provisioned_size' values...
Product: ovirt-engine
Classification: oVirt
Component: RestAPI (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified (vote)
: ovirt-4.2.0
: ---
Assigned To: Juan Hernández
Pavel Stehlik
Allon Mureinik
Depends On:
  Show dependency treegraph
Reported: 2017-06-14 07:09 EDT by shani
Modified: 2017-06-15 06:23 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-06-15 06:23:58 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: Storage
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
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 07:09 EDT, shani
no flags Details

  None (edit)
Description shani 2017-06-14 07:09:03 EDT
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:

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 07:44:44 EDT
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 13:11:05 EDT
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 06:23:58 EDT
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.