[ 
https://issues.apache.org/jira/browse/DTACLOUD-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13188555#comment-13188555
 ] 

Ronelle Landy commented on DTACLOUD-110:
----------------------------------------

Deleting instances using the API seems to be working. The output of the API is 
copied below.

 curl -X DELETE  --user 'username:password' 
"http://server:3001/api/instances/8a513e57-5a30-48af-a27e-bfd954c65be0?format=xml";

 curl -X GET --user 'username:password' 
"http://server.com:3001/api/instances?format=xml";
<?xml version='1.0' encoding='utf-8' ?>
<instances>
</instances>

                
> Deleting VMs does not work with rhevm backend
> ---------------------------------------------
>
>                 Key: DTACLOUD-110
>                 URL: https://issues.apache.org/jira/browse/DTACLOUD-110
>             Project: DeltaCloud
>          Issue Type: Bug
>          Components: Server
>         Environment: deltacloud 0.4.1 (latest version)
>            Reporter: Alfredo Moralejo
>            Assignee: David Lutterkort
>
> When trying to delete a VM in a RHEVM backend I get an error:
> curl -u admin@internal:XXXX -X DELETE 
> http://cf1:3003/api/instances/3930521c-9e71-407b-878d-6ac47fdea78d
> I get following error from backend:
> [root@cf1 core]# /usr/bin/deltacloudd[8324]: RestClient::BadRequest:400 Bad 
> Request
> According with doc of RHEV-M API in 
> http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Virtualization/3.0/html-single/REST_API_Guide/index.html#sect-REST_API_Guide-Common_Features-Resources-Deleting_Resources
>  the header must only contain "Accept" and it's adding Content-Type too.
> I've applied following patch and it's seems to be working fine now:
> diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb 
> b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
> index 49f6509..908eae3 100644
> --- a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
> +++ b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
> @@ -67,14 +67,19 @@ module RHEVM
>      end
>  
>      def vm_action(id, action, headers={})
> -      headers.merge!(auth_header)
> -      headers.merge!({
> -        :content_type => 'application/xml',
> -        :accept => 'application/xml',
> -      })
>        if action==:delete
> +        headers = {}
> +        headers.merge!(auth_header)
> +        headers.merge!({
> +          :accept => 'application/xml',
> +        })
>          RHEVM::client(@api_entrypoint)["/vms/%s" % id].delete(headers)
>        else
> +        headers.merge!(auth_header)
> +        headers.merge!({
> +          :content_type => 'application/xml',
> +          :accept => 'application/xml',
> +        })
>          begin
>            client_response = RHEVM::client(@api_entrypoint)["/vms/%s/%s" % 
> [id, action]].post('<action/>', headers)
>          rescue

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to