Joseph J. VLcek created DTACLOUD-457:
----------------------------------------

             Summary: RHEVm, Passing an invalid instance ID to start instance 
results in traceback with 500. 
                 Key: DTACLOUD-457
                 URL: https://issues.apache.org/jira/browse/DTACLOUD-457
             Project: DeltaCloud
          Issue Type: Bug
         Environment: RHEVm3.1
            Reporter: Joseph J. VLcek
            Assignee: Joseph J. VLcek


When starting an instance on RHEVm and passing an invalid instance ID to
POST "start" generates the following traceback with 500.

Instead of 500 404 or 403 should be returned.


% curl   -X POST   --user "${CREDS}"
"http://localhost:3001/api/instances/${INSTANCE_ID}/start?format=xml";
<?xml version='1.0' encoding='utf-8' ?>
<error status='500'
url='/api/instances/INVALID INSTANCE ID/start'>
  <kind>backend_error</kind>
  <backend driver='rhevm'
provider='PROVIDER'>
    <code>500</code>
  </backend>
  <message><![CDATA[undefined method `state' for nil:NilClass]]></message>

<backtrace><![CDATA[<REPO>/GIT/DELTACLOUD_OVIRT/deltacloud/server/lib/deltacloud/helpers/deltacloud_helper.rb:147:in
`instance_action'
<REPO>/GIT/DELTACLOUD_OVIRT/deltacloud/server/lib/deltacloud/collections/instances.rb:93:in
`block (3 levels) in <class:Instances>'
<LOCAL 
GEMS>/.gem/ruby/1.9.1/gems/sinatra-rabbit-1.1.3/lib/sinatra/rabbit/base.rb:396:in
`instance_eval'
<LOCAL 
GEMS>/.gem/ruby/1.9.1/gems/sinatra-rabbit-1.1.3/lib/sinatra/rabbit/base.rb:396:in
`block in control'
<LOCAL GEMS>/.gem/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:1293:in
`call'
<LOCAL GEMS>/.gem/ruby/1.9.1/gems/sinatra-1.3.4/lib/sinatra/base.rb:1293:in
`block in compile!'
...

Comments from mfojtik: on IRC

I think the problem is here: original_instance = driver.instance(credentials, 
:id => params[:id])
this call return 'nil' and that will make the instance_actions_for helper die


secondary bug is that we should report 404 in that case not 500
POST /api/instances/unknown-instance/start should return 404 or 403 (forbiden)


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to