provider/openstack: Handle cases where volumes are disabled (#12374)

This commit handles the case where the volume API extensions are
disabled.
This commit is contained in:
Joe Topjian 2017-03-05 06:53:09 -07:00 committed by Paul Stack
parent 300ff13b58
commit 4ba145a3ac
1 changed files with 8 additions and 1 deletions

View File

@ -1477,7 +1477,14 @@ func getVolumeAttachments(computeClient *gophercloud.ServiceClient, d *schema.Re
allPages, err := volumeattach.List(computeClient, d.Id()).AllPages()
if err != nil {
return err
if errCode, ok := err.(gophercloud.ErrUnexpectedResponseCode); ok {
if errCode.Actual == 403 {
log.Printf("[DEBUG] os-volume_attachments disabled.")
return nil
} else {
return err
}
}
}
allVolumeAttachments, err := volumeattach.ExtractVolumeAttachments(allPages)