@@ -160,7 +160,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
160
160
case selectRandomMatchingAccountField :
161
161
value , err := strconv .ParseBool (v )
162
162
if err != nil {
163
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid %s: %s in storage class" , selectRandomMatchingAccountField , v ) )
163
+ return nil , status .Errorf (codes .InvalidArgument , "invalid %s: %s in storage class" , selectRandomMatchingAccountField , v )
164
164
}
165
165
selectRandomMatchingAccount = value
166
166
case secretNameField :
@@ -180,15 +180,15 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
180
180
case enableLargeFileSharesField :
181
181
value , err := strconv .ParseBool (v )
182
182
if err != nil {
183
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid %s: %s in storage class" , enableLargeFileSharesField , v ) )
183
+ return nil , status .Errorf (codes .InvalidArgument , "invalid %s: %s in storage class" , enableLargeFileSharesField , v )
184
184
}
185
185
enableLFS = & value
186
186
case useDataPlaneAPIField :
187
187
useDataPlaneAPI = strings .EqualFold (v , trueValue )
188
188
case disableDeleteRetentionPolicyField :
189
189
value , err := strconv .ParseBool (v )
190
190
if err != nil {
191
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid %s: %s in storage class" , disableDeleteRetentionPolicyField , v ) )
191
+ return nil , status .Errorf (codes .InvalidArgument , "invalid %s: %s in storage class" , disableDeleteRetentionPolicyField , v )
192
192
}
193
193
disableDeleteRetentionPolicy = & value
194
194
case pvcNamespaceKey :
@@ -209,13 +209,13 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
209
209
case allowBlobPublicAccessField :
210
210
value , err := strconv .ParseBool (v )
211
211
if err != nil {
212
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid %s: %s in storage class" , allowBlobPublicAccessField , v ) )
212
+ return nil , status .Errorf (codes .InvalidArgument , "invalid %s: %s in storage class" , allowBlobPublicAccessField , v )
213
213
}
214
214
allowBlobPublicAccess = & value
215
215
case allowSharedKeyAccessField :
216
216
value , err := strconv .ParseBool (v )
217
217
if err != nil {
218
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid %s: %s in storage class" , allowSharedKeyAccessField , v ) )
218
+ return nil , status .Errorf (codes .InvalidArgument , "invalid %s: %s in storage class" , allowSharedKeyAccessField , v )
219
219
}
220
220
allowSharedKeyAccess = & value
221
221
case pvcNameKey :
@@ -231,7 +231,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
231
231
case mountPermissionsField :
232
232
// only do validations here, used in NodeStageVolume, NodePublishVolume
233
233
if _ , err := strconv .ParseUint (v , 8 , 32 ); err != nil {
234
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid mountPermissions %s in storage class" , v ) )
234
+ return nil , status .Errorf (codes .InvalidArgument , "invalid mountPermissions %s in storage class" , v )
235
235
}
236
236
case vnetResourceGroupField :
237
237
vnetResourceGroup = v
@@ -244,39 +244,39 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
244
244
case requireInfraEncryptionField :
245
245
value , err := strconv .ParseBool (v )
246
246
if err != nil {
247
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid %s: %s in storage class" , requireInfraEncryptionField , v ) )
247
+ return nil , status .Errorf (codes .InvalidArgument , "invalid %s: %s in storage class" , requireInfraEncryptionField , v )
248
248
}
249
249
requireInfraEncryption = & value
250
250
case enableMultichannelField :
251
251
value , err := strconv .ParseBool (v )
252
252
if err != nil {
253
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid %s: %s in storage class" , enableMultichannelField , v ) )
253
+ return nil , status .Errorf (codes .InvalidArgument , "invalid %s: %s in storage class" , enableMultichannelField , v )
254
254
}
255
255
isMultichannelEnabled = & value
256
256
case getLatestAccountKeyField :
257
257
value , err := strconv .ParseBool (v )
258
258
if err != nil {
259
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid %s: %s in storage class" , getLatestAccountKeyField , v ) )
259
+ return nil , status .Errorf (codes .InvalidArgument , "invalid %s: %s in storage class" , getLatestAccountKeyField , v )
260
260
}
261
261
getLatestAccountKey = value
262
262
case accountQuotaField :
263
263
value , err := strconv .ParseInt (v , 10 , 32 )
264
264
if err != nil || value < minimumAccountQuota {
265
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid accountQuota %s in storage class, minimum quota: %d" , v , minimumAccountQuota ) )
265
+ return nil , status .Errorf (codes .InvalidArgument , "invalid accountQuota %s in storage class, minimum quota: %d" , v , minimumAccountQuota )
266
266
}
267
267
accountQuota = int32 (value )
268
268
default :
269
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid parameter %q in storage class" , k ) )
269
+ return nil , status .Errorf (codes .InvalidArgument , "invalid parameter %q in storage class" , k )
270
270
}
271
271
}
272
272
273
273
if matchTags && account != "" {
274
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "matchTags must set as false when storageAccount(%s) is provided" , account ) )
274
+ return nil , status .Errorf (codes .InvalidArgument , "matchTags must set as false when storageAccount(%s) is provided" , account )
275
275
}
276
276
277
277
if subsID != "" && subsID != d .cloud .SubscriptionID {
278
278
if resourceGroup == "" {
279
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "resourceGroup must be provided in cross subscription(%s)" , subsID ) )
279
+ return nil , status .Errorf (codes .InvalidArgument , "resourceGroup must be provided in cross subscription(%s)" , subsID )
280
280
}
281
281
}
282
282
@@ -402,7 +402,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
402
402
403
403
tags , err := ConvertTagsToMap (customTags )
404
404
if err != nil {
405
- return nil , status .Errorf (codes .InvalidArgument , err . Error () )
405
+ return nil , status .Errorf (codes .InvalidArgument , "%v" , err )
406
406
}
407
407
408
408
if strings .TrimSpace (storageEndpointSuffix ) == "" {
@@ -469,7 +469,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
469
469
// search in cache first
470
470
cache , err := d .accountSearchCache .Get (lockKey , azcache .CacheReadTypeDefault )
471
471
if err != nil {
472
- return nil , status .Errorf (codes .Internal , err . Error () )
472
+ return nil , status .Errorf (codes .Internal , "%v" , err )
473
473
}
474
474
if cache != nil {
475
475
accountName = cache .(string )
@@ -525,7 +525,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
525
525
// skip validating file share quota if useDataPlaneAPI
526
526
} else {
527
527
if quota , err := d .getFileShareQuota (ctx , subsID , resourceGroup , accountName , validFileShareName , secret ); err != nil {
528
- return nil , status .Errorf (codes .Internal , err . Error () )
528
+ return nil , status .Errorf (codes .Internal , "%v" , err )
529
529
} else if quota != - 1 && quota < fileShareSize {
530
530
return nil , status .Errorf (codes .AlreadyExists , "request file share(%s) already exists, but its capacity %d is smaller than %d" , validFileShareName , quota , fileShareSize )
531
531
}
@@ -552,7 +552,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
552
552
d .volumeLocks .Release (volName )
553
553
// clean search cache
554
554
if err := d .accountSearchCache .Delete (lockKey ); err != nil {
555
- return nil , status .Errorf (codes .Internal , err . Error () )
555
+ return nil , status .Errorf (codes .Internal , "%v" , err )
556
556
}
557
557
// remove the volName from the volMap to stop matching the same storage account
558
558
d .volMap .Delete (volName )
@@ -935,7 +935,7 @@ func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequ
935
935
case useDataPlaneAPIField :
936
936
useDataPlaneAPI = strings .EqualFold (v , trueValue )
937
937
default :
938
- return nil , status .Errorf (codes .InvalidArgument , fmt . Sprintf ( "invalid parameter %q in storage class" , k ) )
938
+ return nil , status .Errorf (codes .InvalidArgument , "invalid parameter %q in storage class" , k )
939
939
}
940
940
}
941
941
@@ -1300,11 +1300,11 @@ func isValidVolumeCapabilities(volCaps []*csi.VolumeCapability) error {
1300
1300
func generateSASToken (accountName , accountKey , storageEndpointSuffix string , expiryTime int ) (string , error ) {
1301
1301
credential , err := service .NewSharedKeyCredential (accountName , accountKey )
1302
1302
if err != nil {
1303
- return "" , status .Errorf (codes .Internal , fmt . Sprintf ( "failed to generate sas token in creating new shared key credential, accountName: %s, err: %s " , accountName , err . Error ()) )
1303
+ return "" , status .Errorf (codes .Internal , "failed to generate sas token in creating new shared key credential, accountName: %s, err: %v " , accountName , err )
1304
1304
}
1305
1305
serviceClient , err := service .NewClientWithSharedKeyCredential (fmt .Sprintf ("https://%s.file.%s/" , accountName , storageEndpointSuffix ), credential , nil )
1306
1306
if err != nil {
1307
- return "" , status .Errorf (codes .Internal , fmt . Sprintf ( "failed to generate sas token in creating new client with shared key credential, accountName: %s, err: %s " , accountName , err . Error ()) )
1307
+ return "" , status .Errorf (codes .Internal , "failed to generate sas token in creating new client with shared key credential, accountName: %s, err: %v " , accountName , err )
1308
1308
}
1309
1309
nowTime := time .Now ()
1310
1310
sasURL , err := serviceClient .GetSASURL (
0 commit comments