Skip to content

Commit

Permalink
Merge pull request #1387 from ish-hcc/openstack_fix_client
Browse files Browse the repository at this point in the history
OpenStack: Fix volume clinet initialization
  • Loading branch information
powerkimhub authored Nov 22, 2024
2 parents 1c43f97 + 8f37404 commit a5cba7d
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package openstack

import (
"crypto/tls"
"fmt"
"net/http"

oscon "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/drivers/openstack/connect"
Expand Down Expand Up @@ -133,20 +134,15 @@ func clientCreator(connInfo idrv.ConnectionInfo) (icon.CloudConnection, error) {
return nil, err
}

iConn.Volume2Client, err = openstack.NewBlockStorageV2(provider, gophercloud.EndpointOpts{
iConn.Volume3Client, err = openstack.NewBlockStorageV3(provider, gophercloud.EndpointOpts{
Region: connInfo.RegionInfo.Region,
})
if iConn.Volume2Client == nil {
var err2 error
iConn.Volume3Client, err2 = openstack.NewBlockStorageV3(provider, gophercloud.EndpointOpts{
if err != nil {
iConn.Volume2Client, err = openstack.NewBlockStorageV2(provider, gophercloud.EndpointOpts{
Region: connInfo.RegionInfo.Region,
})

if err != nil && iConn.Volume3Client == nil {
return nil, err
}
if err2 != nil {
return nil, err
if err != nil {
return nil, fmt.Errorf("failed to initialize both volume v3 and v2 clients: %v", err)
}
}

Expand Down

0 comments on commit a5cba7d

Please sign in to comment.