Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit b64fd20

Browse files
committed
Fix selection of v2 volumes in openstack/blockstorage
1 parent adc2065 commit b64fd20

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

openstack/client.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -283,25 +283,12 @@ func NewBlockStorageV1(client *gophercloud.ProviderClient, eo gophercloud.Endpoi
283283

284284
// NewBlockStorageV2 creates a ServiceClient that may be used to access the v2 block storage service.
285285
func NewBlockStorageV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
286-
eo.ApplyDefaults("volume")
286+
eo.ApplyDefaults("volumev2")
287287
url, err := client.EndpointLocator(eo)
288288
if err != nil {
289289
return nil, err
290290
}
291-
292-
// Force using v2 API
293-
if strings.Contains(url, "/v1") {
294-
url = strings.Replace(url, "/v1", "/v2", -1)
295-
}
296-
if !strings.Contains(url, "/v2") {
297-
return nil, fmt.Errorf("Block Storage v2 endpoint not found")
298-
}
299-
300-
return &gophercloud.ServiceClient{
301-
ProviderClient: client,
302-
Endpoint: url,
303-
ResourceBase: url,
304-
}, nil
291+
return &gophercloud.ServiceClient{ProviderClient: client, Endpoint: url}, nil
305292
}
306293

307294
// NewCDNV1 creates a ServiceClient that may be used to access the OpenStack v1

0 commit comments

Comments
 (0)