Terminateinstances

harlowja edited this page Apr 11, 2012 · 14 revisions

TerminateInstances

Method information

Request

Type: GET/POST

Uri: http://$HOST:$PORT/$PATH/

Notes: Performed using euca-terminate-instances using euca2ools_2.0.0~bzr464-0ubuntu2 on Ubuntu 11.10

Params:

AWSAccessKeyId=<VARIABLE>&Action=TerminateInstances&InstanceId.1=<VARIABLE>&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=<VARIABLE>&Version=2009-11-30

  1. Multiple instance ids can be passed in of the form InstanceId.X (where X >= 1)

Exact version requested: 2009-11-30

Restricted to: projectmanager, sysadmin

Docs

  1. http://docs.amazonwebservices.com/AWSEC2/2009-11-30/APIReference/index.html?ApiReference-query-TerminateInstances.html

XSD

  1. https://github.com/yahoo/Openstack-EC2/blob/master/data/xsds/2009-11-30.ec2.wsdl.xsd#L355

Expected response

An XML response (with status code 200) conforming to the previous XSD would be expected.

Actual response

<?xml version="1.0" ?>
<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/">
   <requestId>req-9eee4d9a-281f-461f-b9fa-473bf91c09f6</requestId>
   <instancesSet>
      <item>
         <instanceId>i-00000001</instanceId>
         <shutdownState>
            <code>0</code>
            <name>error</name>
         </shutdownState>
         <previousState>
            <code>0</code>
            <name>error</name>
         </previousState>
      </item>
   </instancesSet>
</TerminateInstancesResponse>

Errors

An error will be sent back in the following XML format (with a 400 status code):

<?xml version="1.0"?>
<Response>
   <Errors>
      <Error>
         <Code>%s</Code>
         <Message>%s</Message>
      </Error>
   </Errors>
   <RequestID>%s</RequestID>
</Response>

Codes

  1. InstanceNotFound (is this also returned on db failures?)
  2. InvalidInstanceIDMalformed
  3. MigrationNotFoundByStatus (if currently being resized?)
  4. Unauthorized
  5. UnknownError
  6. (Others??)

Issues

  1. Does not comply to defined schema (ordering mainly)
  2. Version support is weak/non-existent; code copies input version parameter and echos it back
  3. Odd code call to is_uuid_like when getting an instance (huh?)
  4. Instances that are set as terminating, may not actual be terminated immediately (more of a good to know)
  5. Instance ids passed in are validated only before they are terminated, thus partial terminations can occur (instead of validating the instances/ids then terminating them)
  6. Response names are not always correct (there is no error name)
  7. The EC2 api states that "terminated instances will remain visible after termination (approximately one hour)", it doesn't seem like openstack does that (its nearly immediate)
  8. Error XML response creation does not do XML escaping, see LP bug #978439
  9. No validation on input of the given version
  10. No validation of the output
    • Does not ensure it conforms to a given version
    • No concept of separate renderers for all supported versions