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

Bug 1437410

Summary: Document that you can't create raw/sparse disks on block storage
Product: Red Hat Enterprise Virtualization Manager Reporter: Paul Dwyer <pdwyer>
Component: ovirt-engineAssignee: Nobody <nobody>
Status: CLOSED ERRATA QA Contact: Yosi Ben Shimon <ybenshim>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.0.6CC: juan.hernandez, lsurette, ratamir, rbalakri, Rhev-m-bugs, srevivo, ykaul
Target Milestone: ovirt-4.2.0   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rhv-4.2.0-8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-15 17:41:09 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 Paul Dwyer 2017-03-30 09:32:10 UTC
Description of problem:
When creating a raw disk via API  on block storage domain if you don't specify sparse it defaults to true which is not valid.
sparse attribute is not listed as mandatory attribute in apidoc


Version-Release number of selected component (if applicable):
Tested on RHEV3.6 and RHV4

How reproducible:
always

Steps to Reproduce:
Sample curl

# curl \
> --cacert '/etc/pki/ovirt-engine/ca.pem' \
> --user 'admin@internal:<password>' \
> --request POST \
> --header 'Version: 4' \
> --header 'Content-Type: application/xml' \
> --header 'Accept: application/xml' \
> --data '
>   <disk>
>     <storage_domains>
>       <storage_domain id="4661b3b4-43be-42b9-855e-56ddd72bf564"/>
>     </storage_domains>
>     <name>testdisk</name>
>     <provisioned_size>1000</provisioned_size>
>     <format>raw</format>
>   </disk>
> ' \
> https://<engine>/ovirt-engine/api/disks


Actual results:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <detail>[Cannot add Virtual Disk. Disk configuration (RAW Sparse) is incompatible with the storage domain type.]</detail>
    <reason>Operation Failed</reason>
</fault>

Expected results:
not default to sparse true and create disk

Additional info:
This can be worked around very easily by adding sparse = false in call to api, however as noted sparse is not a mandatory attribute.

Either a change in api behaviour is needed or change to apidoc to not that sparse is mandatory attribute in this scenario

Comment 1 Allon Mureinik 2017-03-30 11:25:03 UTC
This default comes from the DiskImage's consturctor. At the point it's constructed, we don't have enough info (i.e. - don't have the storage type available) to make any smarter decision. We could, of course, change the default regardless of the storage type, but that sounds like a bigger interference with the customers' working script.

Juan - can we get your two cents on this?

[Tentatively targeting to 4.1.3 to express our willingness to help the customer in case we find a reasonable solution, but in all fairness I'm inclined to close as WONTFIX based on the above]

Comment 2 Juan Hernández 2017-03-30 17:53:05 UTC
I'd say that if sparse=true doesn't make sense for that combination of disk format and storage domain type, we could just ignore it, instead of generating an error. If that is well documented in the specification of the API I don't see it as big problem.

If we finally decide to not fix this, for whatever the reason, we should anyhow document clearly in the API this limitation, including an example:

---8<---
When creating a `raw` disk in a block storage domain (iSCSI or fibre
channel) it is mandatory to specify the also that the disk will not
be sparse:

....
 POST /ovirt-engine/api/disks
....

[source,xml]
----
<disk>
  <storage_domains>
    <storage_domain id="456"/>
  </storage_domains>
  <name>testdisk</name>
  <provisioned_size>1000</provisioned_size>
  <format>raw</format>
  <sparse>false</sparse>
</disk>
----
--->8---

This should go in the two locations where disks can be created: the top level disks collection, and the VM disk attachments collection.

Also, in the description of the Disk.sparse attribute we should also add a note explaining that it is mandatory in this case, and that it must be 'false'.

Comment 3 RHV bug bot 2017-12-06 16:16:35 UTC
INFO: Bug status wasn't changed from MODIFIED to ON_QA due to the following reason:

[No relevant external trackers attached]

For more info please contact: rhv-devops

Comment 4 Yosi Ben Shimon 2017-12-14 11:46:37 UTC
Tested, and a note regarding sparse attribute has been added to the documentation:
https://<your-engine>/ovirt-engine/apidoc/#/services/disks/methods/add

Comment 8 errata-xmlrpc 2018-05-15 17:41:09 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-2018:1488

Comment 9 Franta Kust 2019-05-16 13:07:59 UTC
BZ<2>Jira Resync