Skip to content

Commit

Permalink
Merge pull request #4204 from jtopjian/jtopjian-openstack-deleting-vo…
Browse files Browse the repository at this point in the history
…lume

provider/openstack: Handle volumes in "deleting" state
  • Loading branch information
jtopjian committed Dec 9, 2015
2 parents 377ac3e + c3f6bbc commit 3dc4503
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,13 @@ func resourceBlockStorageVolumeV1Delete(d *schema.ResourceData, meta interface{}
}
}

err = volumes.Delete(blockStorageClient, d.Id()).ExtractErr()
if err != nil {
return fmt.Errorf("Error deleting OpenStack volume: %s", err)
// It's possible that this volume was used as a boot device and is currently
// in a "deleting" state from when the instance was terminated.
// If this is true, just move on. It'll eventually delete.
if v.Status != "deleting" {
if err := volumes.Delete(blockStorageClient, d.Id()).ExtractErr(); err != nil {
return CheckDeleted(d, err, "volume")
}
}

// Wait for the volume to delete before moving on.
Expand Down

0 comments on commit 3dc4503

Please sign in to comment.