Bug 1600534 - Status code from the API for incompatible disk configuration for disk creation is 400 (bad request) instead of 409 (conflict)
Summary: Status code from the API for incompatible disk configuration for disk creatio...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.2.5
Hardware: x86_64
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.2.6
: 4.2.6
Assignee: shani
QA Contact: Shir Fishbain
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-12 12:54 UTC by Elad
Modified: 2018-09-03 15:11 UTC (History)
2 users (show)

Fixed In Version: ovirt-engine-4.2.6
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-03 15:11:02 UTC
oVirt Team: Storage
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)
engine.log (445.11 KB, application/x-gzip)
2018-07-12 12:54 UTC, Elad
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 93113 0 master MERGED core: Change the status code of incompatible disk configuration 2018-07-24 09:26:32 UTC
oVirt gerrit 93291 0 ovirt-engine-4.2 MERGED core: Change the status code of incompatible disk configuration 2018-07-29 07:45:51 UTC

Description Elad 2018-07-12 12:54:49 UTC
Created attachment 1458393 [details]
engine.log

Description of problem:
An attempt to create a disk with an incompatible configuration using REST API (like cow preallocated disk on block based domain), returns a wrong status code - 400 bad request. It should return 409 conflict.


Version-Release number of selected component (if applicable):
rhvm-4.2.5.1_SNAPSHOT-74.gce67578.0.scratch.master.el7ev.noarch
ovirt-engine-restapi-4.2.5.1_SNAPSHOT-74.gce67578.0.scratch.master.el7ev.noarch


How reproducible:
Always

Steps to Reproduce:
1. CREATE to url:/ovirt-engine/api/vms/%vm_id%/diskattachments

Body:

<disk_attachment>
    <active>true</active>
    <bootable>true</bootable>
    <interface>virtio_scsi</interface>
    <disk>
        <format>cow</format>
        <provisioned_size>6442450944</provisioned_size>
        <sparse>false</sparse>
        <wipe_after_delete>false</wipe_after_delete>
        <storage_domains>
            <storage_domain href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a" id="2b18cf8f-af82-4492-8ae8-0b6d1c92422a">
                <actions>
                    <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/isattached" rel="isattached"/>
                    <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/updateovfstore" rel="updateovfstore"/>
                    <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/refreshluns" rel="refreshluns"/>
                    <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/reduceluns" rel="reduceluns"/>
                </actions>
                <name>sd_TestRandom_1215074360</name>
                <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/disksnapshots" rel="disksnapshots"/>
                <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/storageconnections" rel="storageconnections"/>
                <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/permissions" rel="permissions"/>
                <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/templates" rel="templates"/>
                <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/vms" rel="vms"/>
                <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/diskprofiles" rel="diskprofiles"/>
                <link href="/ovirt-engine/api/storagedomains/2b18cf8f-af82-4492-8ae8-0b6d1c92422a/disks" rel="disks"/>
                <available>44023414784</available>
                <backup>false</backup>
                <committed>3221225472</committed>
                <critical_space_action_blocker>5</critical_space_action_blocker>
                <discard_after_delete>false</discard_after_delete>
                <external_status>ok</external_status>
                <master>false</master>
                <storage>
                    <type>iscsi</type>
                    <volume_group id="fROeVi-b4m8-A815-yzfd-SP0o-vtGv-OgoQln">
                        <logical_units>
                            <logical_unit id="3514f0c5a516004a7">
                                <address>10.35.146.129</address>
                                <discard_max_size>8388608</discard_max_size>
                                <discard_zeroes_data>false</discard_zeroes_data>
                                <lun_mapping>4</lun_mapping>
                                <paths>0</paths>
                                <port>3260</port>
                                <portal>10.35.146.129:3260,1</portal>
                                <product_id>XtremApp</product_id>
                                <serial>SXtremIO_XtremApp_XIO00153500071</serial>
                                <size>53687091200</size>
                                <storage_domain_id>2b18cf8f-af82-4492-8ae8-0b6d1c92422a</storage_domain_id>
                                <target>iqn.2008-05.com.xtremio:xio00153500071-514f0c50023f6c00</target>
                                <vendor_id>XtremIO</vendor_id>
                                <volume_group_id>fROeVi-b4m8-A815-yzfd-SP0o-vtGv-OgoQln</volume_group_id>
                            </logical_unit>
                        </logical_units>
                    </volume_group>
                </storage>
                <storage_format>v4</storage_format>
                <supports_discard>true</supports_discard>
                <supports_discard_zeroes_data>false</supports_discard_zeroes_data>
                <type>data</type>
                <used>8589934592</used>
                <warning_low_space_indicator>10</warning_low_space_indicator>
                <wipe_after_delete>false</wipe_after_delete>
                <data_centers>
                    <data_center href="/ovirt-engine/api/datacenters/aed90379-9c50-4f12-9d24-899e3b7c6c26" id="aed90379-9c50-4f12-9d24-899e3b7c6c26"/>
                </data_centers>
            </storage_domain>
        </storage_domains>
    </disk>
</disk_attachment>



Actual results:

The status code is 400 bad request:


2018-07-12 15:11:53,547 - MainThread - api_utils - ERROR - Failed to create element NOT as expected:
        Status: 400
        Reason: Bad Request
        Detail: [Cannot add Virtual Disk. Disk configuration (COW Preallocated) is incompatible with the storage domain type.]



Expected results:
The status code should be 409 conflict.

Additional info:

Comment 1 Elad 2018-07-12 13:07:08 UTC
We need this bug to be fixed for automation purposes.

Comment 2 Shir Fishbain 2018-08-12 15:02:19 UTC
The status is 409 conflict.
Response:
<fault>
  <detail>[Cannot add Virtual Disk. Disk configuration (COW Preallocated) is incompatible with the storage domain type.]</detail>
  <reason>Operation Failed</reason>
</fault>

ovirt-engine-4.2.6-0.1.el7ev.noarch


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