~smoser/ubuntu-on-ec2/ec2-publishing-scripts.detach-vol-cleanups

Viewing all changes in revision 408.

  • Committer: Scott Moser
  • Date: 2012-01-05 19:05:50 UTC
  • Revision ID: smoser@ubuntu.com-20120105190550-4dfdp4nf1iemiz42
remove race condition in detach_vol

detach_vol had an issue where if the state of the image went from
'in-use' (or anything) to 'available' after we checked for the shortcut
path, but before the 'detach-vol' call was received, then it would
return failure.

This now does:
 * check state of vol
   * if vol in 'available', return 0
 * detach vol
   * if detach failed
     * check state
       * if vol is available, return 0
       * else return failure

It leaves in the 'detach-vol' by design as euca calls are just so much
faster.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: