On Nov 27, 2011, at 5:24 PM, Alfredo Moralejo (Created) (JIRA) wrote: Thanks Alfredo! Patch was pushed to SVN.
-- Michal > 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 > > ------------------------------------------------------ Michal Fojtik, [email protected] Deltacloud API: http://deltacloud.org
