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

Bug 1340164

Summary: Failed to delete a specified storage domain in the system
Product: [oVirt] ovirt-engine Reporter: Raz Tamir <ratamir>
Component: RestAPIAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Kubica <pkubica>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 4.0.0CC: bugs, gklein, juan.hernandez, pkubica, stirabos
Target Milestone: ovirt-4.0.0-rcKeywords: Automation, AutomationBlocker, Regression
Target Release: 4.0.0Flags: rule-engine: ovirt-4.0.0+
rule-engine: blocker+
rule-engine: planning_ack+
juan.hernandez: devel_ack+
rule-engine: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-05 07:46:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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:
<fault>
    <reason>host parameter is missing</reason>
</fault>

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

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

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

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):
ovirt-engine-4.0.0-0.7.master.el7ev.noarch


How reproducible:
100%

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

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

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
4.1.0-0.0.master.20160613231338.git6e72c0b.el7.centos
and it worked only 
DELETE /ovirt-engine/api/storagedomains/123?format=true&host=myhost

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

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.