Fix selection of v2 volumes in openstack/blockstorage
diff --git a/openstack/client.go b/openstack/client.go
index b533e83..0585211 100644
--- a/openstack/client.go
+++ b/openstack/client.go
@@ -283,25 +283,12 @@
// NewBlockStorageV2 creates a ServiceClient that may be used to access the v2 block storage service.
func NewBlockStorageV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
- eo.ApplyDefaults("volume")
+ eo.ApplyDefaults("volumev2")
url, err := client.EndpointLocator(eo)
if err != nil {
return nil, err
}
-
- // Force using v2 API
- if strings.Contains(url, "/v1") {
- url = strings.Replace(url, "/v1", "/v2", -1)
- }
- if !strings.Contains(url, "/v2") {
- return nil, fmt.Errorf("Block Storage v2 endpoint not found")
- }
-
- return &gophercloud.ServiceClient{
- ProviderClient: client,
- Endpoint: url,
- ResourceBase: url,
- }, nil
+ return &gophercloud.ServiceClient{ProviderClient: client, Endpoint: url}, nil
}
// NewCDNV1 creates a ServiceClient that may be used to access the OpenStack v1