Skip to content

Commit

Permalink
Merge pull request #2946 from gophercloud/bp-v2-8602cd4
Browse files Browse the repository at this point in the history
[v2] Use volumeID, not attachmentID, to detach volume
  • Loading branch information
pierreprinetti committed Feb 26, 2024
2 parents 2444539 + 5e203ec commit 6aa4888
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions openstack/compute/v2/extensions/volumeattach/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Example to Attach a Volume
Example to Detach a Volume
serverID := "7ac8686c-de71-4acb-9600-ec18b1a1ed6d"
attachmentID := "ed081613-1c9b-4231-aa5e-ebfd4d87f983"
volumeID := "ed081613-1c9b-4231-aa5e-ebfd4d87f983"
err := volumeattach.Delete(computeClient, serverID, attachmentID).ExtractErr()
err := volumeattach.Delete(computeClient, serverID, volumeID).ExtractErr()
if err != nil {
panic(err)
}
Expand Down
8 changes: 4 additions & 4 deletions openstack/compute/v2/extensions/volumeattach/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ func Create(ctx context.Context, client *gophercloud.ServiceClient, serverID str
}

// Get returns public data about a previously created VolumeAttachment.
func Get(ctx context.Context, client *gophercloud.ServiceClient, serverID, attachmentID string) (r GetResult) {
resp, err := client.Get(ctx, getURL(client, serverID, attachmentID), &r.Body, nil)
func Get(ctx context.Context, client *gophercloud.ServiceClient, serverID, volumeID string) (r GetResult) {
resp, err := client.Get(ctx, getURL(client, serverID, volumeID), &r.Body, nil)
_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)
return
}

// Delete requests the deletion of a previous stored VolumeAttachment from
// the server.
func Delete(ctx context.Context, client *gophercloud.ServiceClient, serverID, attachmentID string) (r DeleteResult) {
resp, err := client.Delete(ctx, deleteURL(client, serverID, attachmentID), nil)
func Delete(ctx context.Context, client *gophercloud.ServiceClient, serverID, volumeID string) (r DeleteResult) {
resp, err := client.Delete(ctx, deleteURL(client, serverID, volumeID), nil)
_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)
return
}

0 comments on commit 6aa4888

Please sign in to comment.