Snaptastic icon indicating copy to clipboard operation
Snaptastic copied to clipboard

Retry if instance is not in 'running' state

Open mikery opened this issue 10 years ago • 0 comments

It appears there is sometimes a delay which causes the EC2 API to believe the instance is not yet in the 'running' state. The breaks snaptastic, leading to the error:

Jul 18 09:57:44 ip-172-31-12-253 startup:   File "/usr/lib/python2.6/site-packages/snaptastic/snapshotter.py", line 231, in mount_snapshot
Jul 18 09:57:44 ip-172-31-12-253 startup:     self.attach_volume(ebs_volume, boto_volume)
...
Jul 18 09:57:44 ip-172-31-12-253 startup: boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
Jul 18 09:57:44 ip-172-31-12-253 startup: <?xml version="1.0" encoding="UTF-8"?>
Jul 18 09:57:44 ip-172-31-12-253 startup: <Response><Errors><Error><Code>IncorrectState</Code><Message>Instance 'i-c9e2eef4' is not 'running'.</Message></Error></Errors><RequestID>a958c6d5-95b2-4d50-a31b-edb0d771d0e6</RequestID></Response>

The fact that this script is being executed on instance i-c9e2eef4 suggests that the instance is, in fact, running :)

I suggest we add a try on this. If instance != ready, try again until max_instance_ready_wait has been reached.

mikery avatar Jul 18 '13 10:07 mikery