Bug 744290

Summary: deltacloud-client should throw an exception if an action fails
Product: [Retired] CloudForms Cloud Engine Reporter: Chris Lalancette <clalance>
Component: rubygem-deltacloud-clientAssignee: Michal Fojtik <mfojtik>
Status: CLOSED ERRATA QA Contact: Ronelle Landy <rlandy>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.0.0CC: akarol, dajohnso, deltacloud-maint, dgao, rananda, ssachdev, whayutin
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-15 19:39:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Chris Lalancette 2011-10-07 19:00:35 UTC
Description of problem:

This is a placeholder bug for the issue filed at apache:

https://issues.apache.org/jira/browse/DTACLOUD-89

Comment 2 wes hayutin 2012-01-03 17:43:11 UTC
adding ce-sprint-next bugs to ce-sprint

Comment 3 Michal Fojtik 2012-01-17 15:35:03 UTC
Can we close this as NOTABUG?

Comment 4 wes hayutin 2012-01-25 17:08:34 UTC
explain why this is not a bug, why is the jira open

Comment 5 Michal Fojtik 2012-01-26 14:54:02 UTC
From JIRA:

Which IMHO is the correct way. Simply the method is not available (not exists) for current instance of the Instance. To check if current instance support '.start!' operation (same for stop!, reboot!, etc..) you can do following: 

    instance.respond_to? :start! 
  
Eventually you can call: 

   instance.actions 

This should return following: 

    [["stop", "http://localhost:3002/api/instances/ed84016a-a000-4007-adeb-cde73d0f58a6/stop"], ["create_image", "http://localhost:3002/api/images;instance_id=ed84016a-a000-4007-adeb-cde73d0f58a6"]]

Comment 6 Ronelle Landy 2012-01-26 19:12:03 UTC
Copying comments from corresponding JIRA: DTACLOUD-89

Closing this JIRA issue out. Deltacloud does report when actions are not supported on an instance in a particular state:

Example: executing 'start' on a RUNNING instance

<error status='405' url='/api/instances/bf388696-55a4-4fb2-b2d8-170416651a28/start?format=xml'>
  <message>
    Requested method not allowed
  </message>
  <method>
    POST
  </method>
</error>

and executing GET /api/instance/:id will show the supported actions for the instance in its current state:

 <actions>
    <link href='http://server:3001/api/instances/bf388696-55a4-4fb2-b2d8-170416651a28/stop&#39; method='post' rel='stop' />
    <link href='http://server:3001/api/images;instance_id=bf388696-55a4-4fb2-b2d8-170416651a28&#39; method='post' rel='create_image' />
  </actions>

so comments (in Comment 5 above) are verified.

Will add testing for client responses to backend errors.

Comment 8 errata-xmlrpc 2012-05-15 19:39:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2012-0593.html