@@ -27,7 +27,6 @@ import (
27
27
"google.golang.org/grpc/status"
28
28
"google.golang.org/protobuf/types/known/timestamppb"
29
29
"k8s.io/apimachinery/pkg/util/wait"
30
- "k8s.io/cloud-provider-openstack/pkg/csi/manila/capabilities"
31
30
"k8s.io/cloud-provider-openstack/pkg/csi/manila/options"
32
31
"k8s.io/cloud-provider-openstack/pkg/csi/manila/shareadapters"
33
32
"k8s.io/cloud-provider-openstack/pkg/util"
@@ -123,11 +122,6 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
123
122
return nil , status .Errorf (codes .Unauthenticated , "failed to create Manila v2 client: %v" , err )
124
123
}
125
124
126
- shareTypeCaps , err := capabilities .GetManilaCapabilities (shareOpts .Type , manilaClient )
127
- if err != nil {
128
- return nil , status .Errorf (codes .Internal , "failed to get Manila capabilities for share type %s: %v" , shareOpts .Type , err )
129
- }
130
-
131
125
requestedSize := req .GetCapacityRange ().GetRequiredBytes ()
132
126
if requestedSize == 0 {
133
127
// At least 1GiB
@@ -159,12 +153,12 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
159
153
return nil , err
160
154
}
161
155
162
- share , err := volCreator .create (req , req .GetName (), sizeInGiB , manilaClient , shareOpts , shareMetadata )
156
+ share , err := volCreator .create (manilaClient , req , req .GetName (), sizeInGiB , shareOpts , shareMetadata )
163
157
if err != nil {
164
158
return nil , err
165
159
}
166
160
167
- err = verifyVolumeCompatibility (sizeInGiB , req , share , shareOpts , cs . d . compatOpts , shareTypeCaps )
161
+ err = verifyVolumeCompatibility (sizeInGiB , req , share , shareOpts )
168
162
if err != nil {
169
163
return nil , status .Errorf (codes .AlreadyExists , "volume %s already exists, but is incompatible with the request: %v" , req .GetName (), err )
170
164
}
@@ -212,7 +206,7 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
212
206
return nil , status .Errorf (codes .Unauthenticated , "failed to create Manila v2 client: %v" , err )
213
207
}
214
208
215
- if err := deleteShare (req .GetVolumeId (), manilaClient ); err != nil {
209
+ if err := deleteShare (manilaClient , req .GetVolumeId ()); err != nil {
216
210
return nil , status .Errorf (codes .Internal , "failed to delete volume %s: %v" , req .GetVolumeId (), err )
217
211
}
218
212
@@ -271,7 +265,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
271
265
272
266
// Retrieve an existing snapshot or create a new one
273
267
274
- snapshot , err := getOrCreateSnapshot (req .GetName (), sourceShare .ID , manilaClient )
268
+ snapshot , err := getOrCreateSnapshot (manilaClient , req .GetName (), sourceShare .ID )
275
269
if err != nil {
276
270
if wait .Interrupted (err ) {
277
271
return nil , status .Errorf (codes .DeadlineExceeded , "deadline exceeded while waiting for snapshot %s of volume %s to become available" , snapshot .ID , req .GetSourceVolumeId ())
@@ -299,9 +293,9 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
299
293
readyToUse = true
300
294
case snapshotError :
301
295
// An error occurred, try to roll-back the snapshot
302
- tryDeleteSnapshot (snapshot , manilaClient )
296
+ tryDeleteSnapshot (manilaClient , snapshot )
303
297
304
- manilaErrMsg , err := lastResourceError (snapshot .ID , manilaClient )
298
+ manilaErrMsg , err := lastResourceError (manilaClient , snapshot .ID )
305
299
if err != nil {
306
300
return nil , status .Errorf (codes .Internal , "snapshot %s of volume %s is in error state, error description could not be retrieved: %v" , snapshot .ID , req .GetSourceVolumeId (), err .Error ())
307
301
}
@@ -344,7 +338,7 @@ func (cs *controllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS
344
338
return nil , status .Errorf (codes .Unauthenticated , "failed to create Manila v2 client: %v" , err )
345
339
}
346
340
347
- if err := deleteSnapshot (req .GetSnapshotId (), manilaClient ); err != nil {
341
+ if err := deleteSnapshot (manilaClient , req .GetSnapshotId ()); err != nil {
348
342
return nil , status .Errorf (codes .Internal , "failed to delete snapshot %s: %v" , req .GetSnapshotId (), err )
349
343
}
350
344
@@ -482,7 +476,7 @@ func (cs *controllerServer) ControllerExpandVolume(ctx context.Context, req *csi
482
476
}, nil
483
477
}
484
478
485
- share , err = extendShare (share .ID , desiredSizeInGiB , manilaClient )
479
+ share , err = extendShare (manilaClient , share .ID , desiredSizeInGiB )
486
480
if err != nil {
487
481
return nil , err
488
482
}
0 commit comments