Volume Pending States

This commit adds pending states for volume attachment, detachment,
and deletion.
This commit is contained in:
Joe Topjian 2015-03-13 22:24:13 +00:00 committed by Jon Perritt
parent f5feb7fbbb
commit f011462e30
2 changed files with 4 additions and 2 deletions

View File

@ -264,7 +264,7 @@ func resourceBlockStorageVolumeV1Delete(d *schema.ResourceData, meta interface{}
}
stateConf := &resource.StateChangeConf{
Pending: []string{"in-use"},
Pending: []string{"in-use", "attaching"},
Target: "available",
Refresh: VolumeV1StateRefreshFunc(blockStorageClient, d.Id()),
Timeout: 10 * time.Minute,
@ -290,7 +290,7 @@ func resourceBlockStorageVolumeV1Delete(d *schema.ResourceData, meta interface{}
log.Printf("[DEBUG] Waiting for volume (%s) to delete", d.Id())
stateConf := &resource.StateChangeConf{
Pending: []string{"deleting"},
Pending: []string{"deleting", "available"},
Target: "deleted",
Refresh: VolumeV1StateRefreshFunc(blockStorageClient, d.Id()),
Timeout: 10 * time.Minute,

View File

@ -944,6 +944,7 @@ func attachVolumesToInstance(computeClient *gophercloud.ServiceClient, blockClie
}
stateConf := &resource.StateChangeConf{
Pending: []string{"attaching", "available"},
Target: "in-use",
Refresh: VolumeV1StateRefreshFunc(blockClient, va["volume_id"].(string)),
Timeout: 30 * time.Minute,
@ -972,6 +973,7 @@ func detachVolumesFromInstance(computeClient *gophercloud.ServiceClient, blockCl
}
stateConf := &resource.StateChangeConf{
Pending: []string{"detaching", "in-use"},
Target: "available",
Refresh: VolumeV1StateRefreshFunc(blockClient, va["volume_id"].(string)),
Timeout: 30 * time.Minute,