Bug 1340164 - Failed to delete a specified storage domain in the system
Summary: Failed to delete a specified storage domain in the system
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.0.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: ovirt-4.0.0-rc
: 4.0.0
Assignee: Juan Hernández
QA Contact: Petr Kubica
Depends On:
TreeView+ depends on / blocked
Reported: 2016-05-26 14:56 UTC by Raz Tamir
Modified: 2016-07-05 07:46 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2016-07-05 07:46:13 UTC
oVirt Team: Infra
rule-engine: ovirt-4.0.0+
rule-engine: blocker+
rule-engine: planning_ack+
juan.hernandez: devel_ack+
rule-engine: testing_ack+

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
oVirt gerrit 58270 0 master MERGED restapi: Add support for V3 SD delete with body 2016-05-30 15:19:30 UTC
oVirt gerrit 58281 0 ovirt-engine-4.0 MERGED restapi: Add support for V3 SD delete with body 2016-05-30 19:43:01 UTC

Description Raz Tamir 2016-05-26 14:56:03 UTC
Description of problem:
When trying to delete a storage domain using the REST API, the return code is 400 and the response body is:
    <reason>host parameter is missing</reason>

The call is - DELETE ovirt-engine/api/storagedomains/3c0a32b7-0ec1-4dd5-a1e4-54156a4753b4 body:
    <host id="724a18e4-bd69-42d9-a547-9f3aece0d0f4"/>

* Same result even without <format>true</format>

In rsdl, the parameter set is:
 <parameter required="false" type="xs:boolean" context="matrix">
 <parameter required="true" type="xs:string" context="matrix">
  <value>the id or name of the host</value>
 <parameter required="false" type="xs:boolean" context="matrix">

So it seems there is a problem here as well (the parameter name is 'destroy' instead of host), so I tried 'destroy' instead of 'host' just to check it that's the bug but the behavior is the same

No logs attached because the request don't even get's to the engine 

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
- Have a detached storage domain
1. Send DELETE request to ovirt-engine/api/storagedomains/<sd_id> with body:
    <host id="724a18e4-bd69-42d9-a547-9f3aece0d0f4"/>

Actual results:
return code 400
    <reason>host parameter is missing</reason>

Expected results:

Additional info:

Comment 1 Juan Hernández 2016-05-30 13:20:25 UTC
These three parameters have been removed from version 4 of the API, and in general bodies are forbidden for DELETE operations. However, they should still be supported in version 3 of the API, so we are re-adding them to the backwards compatibility layer.

Note that in the future you will need to use parameters instead of bodies, for example, to specify both "format" and "host":

  DELETE /ovirt-engine/api/storagedomains/123?format=true&host=myhost

Comment 2 Petr Kubica 2016-06-14 13:53:34 UTC
I tested this in ovirt
and it worked only 
DELETE /ovirt-engine/api/storagedomains/123?format=true&host=myhost

when I use body (without url parameters)
    <host id="724a18e4-bd69-42d9-a547-9f3aece0d0f4"/>

I get the same error as described in bug (host parameter is missing)

Comment 3 Juan Hernández 2016-06-14 13:59:22 UTC
Was that using version 3 of the API? In version 4 of the API request body for DELETE requests is just ignored.

Comment 4 Petr Kubica 2016-06-14 15:39:14 UTC
Use api/v3/.. solved it (for using API version 3) 

verified in 4.1.0-0.0.master.20160613231338.git6e72c0b.el7.centos

Comment 5 Sandro Bonazzola 2016-07-05 07:46:13 UTC
oVirt 4.0.0 has been released, closing current release.

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