Skip to content

Commit

Permalink
provider/openstack: Handle cases where volumes are disabled (#12374)
Browse files Browse the repository at this point in the history
This commit handles the case where the volume API extensions are
disabled.
  • Loading branch information
jtopjian authored and stack72 committed Mar 5, 2017
1 parent 300ff13 commit 4ba145a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4ba145a

Please sign in to comment.