@@ -24,9 +24,7 @@ import (
24
24
"time"
25
25
26
26
"github.com/IBM-Cloud/power-go-client/clients/instance"
27
- "github.com/IBM-Cloud/power-go-client/errors"
28
27
"github.com/IBM-Cloud/power-go-client/ibmpisession"
29
- "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes"
30
28
"github.com/IBM-Cloud/power-go-client/power/models"
31
29
"github.com/IBM/go-sdk-core/v5/core"
32
30
"github.com/IBM/platform-services-go-sdk/resourcecontrollerv2"
@@ -50,10 +48,6 @@ type PowerVSClient interface {
50
48
}
51
49
52
50
type powerVSCloud struct {
53
- piSession * ibmpisession.IBMPISession
54
-
55
- cloudInstanceID string
56
-
57
51
pvmInstancesClient * instance.IBMPIInstanceClient
58
52
volClient * instance.IBMPIVolumeClient
59
53
}
@@ -99,8 +93,6 @@ func newPowerVSCloud(cloudInstanceID, zone string, debug bool) (Cloud, error) {
99
93
pvmInstancesClient := instance .NewIBMPIInstanceClient (backgroundContext , piSession , cloudInstanceID )
100
94
101
95
return & powerVSCloud {
102
- piSession : piSession ,
103
- cloudInstanceID : cloudInstanceID ,
104
96
pvmInstancesClient : pvmInstancesClient ,
105
97
volClient : volClient ,
106
98
}, nil
@@ -249,13 +241,11 @@ func (p *powerVSCloud) WaitForVolumeState(volumeID, state string) error {
249
241
}
250
242
251
243
func (p * powerVSCloud ) GetDiskByName (name string ) (disk * Disk , err error ) {
252
- //TODO: remove capacityBytes
253
- params := p_cloud_volumes .NewPcloudCloudinstancesVolumesGetallParamsWithTimeout (TIMEOUT ).WithCloudInstanceID (p .cloudInstanceID )
254
- resp , err := p .piSession .Power .PCloudVolumes .PcloudCloudinstancesVolumesGetall (params , p .piSession .AuthInfo (p .cloudInstanceID ))
244
+ vols , err := p .volClient .GetAll ()
255
245
if err != nil {
256
- return nil , errors . ToError ( err )
246
+ return nil , err
257
247
}
258
- for _ , v := range resp . Payload .Volumes {
248
+ for _ , v := range vols .Volumes {
259
249
if name == * v .Name {
260
250
return & Disk {
261
251
Name : * v .Name ,
0 commit comments