@@ -215,8 +215,9 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
215
215
var err error
216
216
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
217
217
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
218
+ enableStoragePools := metrics .DefaultEnableStoragePools
218
219
defer func () {
219
- gceCS .Metrics .RecordOperationErrorMetrics ("CreateVolume" , err , diskTypeForMetric , enableConfidentialCompute )
220
+ gceCS .Metrics .RecordOperationErrorMetrics ("CreateVolume" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
220
221
}()
221
222
// Validate arguments
222
223
volumeCapabilities := req .GetVolumeCapabilities ()
@@ -244,6 +245,8 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
244
245
params , err := common .ExtractAndDefaultParameters (req .GetParameters (), gceCS .Driver .name , gceCS .Driver .extraVolumeLabels )
245
246
diskTypeForMetric = params .DiskType
246
247
enableConfidentialCompute = strconv .FormatBool (params .EnableConfidentialCompute )
248
+ hasStoragePools := len (params .StoragePools ) > 0
249
+ enableStoragePools = strconv .FormatBool (hasStoragePools )
247
250
if err != nil {
248
251
return nil , status .Errorf (codes .InvalidArgument , "failed to extract parameters: %v" , err .Error ())
249
252
}
@@ -457,8 +460,9 @@ func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.Del
457
460
var err error
458
461
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
459
462
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
463
+ enableStoragePools := metrics .DefaultEnableStoragePools
460
464
defer func () {
461
- gceCS .Metrics .RecordOperationErrorMetrics ("DeleteVolume" , err , diskTypeForMetric , enableConfidentialCompute )
465
+ gceCS .Metrics .RecordOperationErrorMetrics ("DeleteVolume" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
462
466
}()
463
467
// Validate arguments
464
468
volumeID := req .GetVolumeId ()
@@ -488,7 +492,7 @@ func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.Del
488
492
}
489
493
defer gceCS .volumeLocks .Release (volumeID )
490
494
disk , _ := gceCS .CloudProvider .GetDisk (ctx , project , volKey , gce .GCEAPIVersionV1 )
491
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (disk )
495
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (disk )
492
496
err = gceCS .CloudProvider .DeleteDisk (ctx , project , volKey )
493
497
if err != nil {
494
498
return nil , common .LoggedError ("Failed to delete disk: " , err )
@@ -502,8 +506,9 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
502
506
var err error
503
507
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
504
508
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
509
+ enableStoragePools := metrics .DefaultEnableStoragePools
505
510
defer func () {
506
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerPublishVolume" , err , diskTypeForMetric , enableConfidentialCompute )
511
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerPublishVolume" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
507
512
}()
508
513
// Only valid requests will be accepted
509
514
_ , _ , _ , err = gceCS .validateControllerPublishVolumeRequest (ctx , req )
@@ -517,7 +522,7 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
517
522
}
518
523
519
524
resp , err , disk := gceCS .executeControllerPublishVolume (ctx , req )
520
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (disk )
525
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (disk )
521
526
if err != nil {
522
527
klog .Infof ("For node %s adding backoff due to error for volume %s: %v" , req .NodeId , req .VolumeId , err )
523
528
gceCS .errorBackoff .next (backoffId , common .CodeForError (err ))
@@ -667,8 +672,9 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
667
672
var err error
668
673
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
669
674
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
675
+ enableStoragePools := metrics .DefaultEnableStoragePools
670
676
defer func () {
671
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerUnpublishVolume" , err , diskTypeForMetric , enableConfidentialCompute )
677
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerUnpublishVolume" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
672
678
}()
673
679
_ , _ , err = gceCS .validateControllerUnpublishVolumeRequest (ctx , req )
674
680
if err != nil {
@@ -681,7 +687,7 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
681
687
return nil , status .Errorf (gceCS .errorBackoff .code (backoffId ), "ControllerUnpublish not permitted on node %q due to backoff condition" , req .NodeId )
682
688
}
683
689
resp , err , disk := gceCS .executeControllerUnpublishVolume (ctx , req )
684
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (disk )
690
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (disk )
685
691
if err != nil {
686
692
klog .Infof ("For node %s adding backoff due to error for volume %s: %v" , req .NodeId , req .VolumeId , err )
687
693
gceCS .errorBackoff .next (backoffId , common .CodeForError (err ))
@@ -776,8 +782,9 @@ func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context
776
782
var err error
777
783
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
778
784
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
785
+ enableStoragePools := metrics .DefaultEnableStoragePools
779
786
defer func () {
780
- gceCS .Metrics .RecordOperationErrorMetrics ("ValidateVolumeCapabilities" , err , diskTypeForMetric , enableConfidentialCompute )
787
+ gceCS .Metrics .RecordOperationErrorMetrics ("ValidateVolumeCapabilities" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
781
788
}()
782
789
if req .GetVolumeCapabilities () == nil || len (req .GetVolumeCapabilities ()) == 0 {
783
790
return nil , status .Error (codes .InvalidArgument , "Volume Capabilities must be provided" )
@@ -804,7 +811,7 @@ func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context
804
811
defer gceCS .volumeLocks .Release (volumeID )
805
812
806
813
disk , err := gceCS .CloudProvider .GetDisk (ctx , project , volKey , gce .GCEAPIVersionV1 )
807
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (disk )
814
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (disk )
808
815
if err != nil {
809
816
if gce .IsGCENotFoundError (err ) {
810
817
return nil , status .Errorf (codes .NotFound , "Could not find disk %v: %v" , volKey .Name , err .Error ())
@@ -939,8 +946,9 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C
939
946
var err error
940
947
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
941
948
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
949
+ enableStoragePools := metrics .DefaultEnableStoragePools
942
950
defer func () {
943
- gceCS .Metrics .RecordOperationErrorMetrics ("CreateSnapshot" , err , diskTypeForMetric , enableConfidentialCompute )
951
+ gceCS .Metrics .RecordOperationErrorMetrics ("CreateSnapshot" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
944
952
}()
945
953
// Validate arguments
946
954
volumeID := req .GetSourceVolumeId ()
@@ -962,7 +970,7 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C
962
970
963
971
// Check if volume exists
964
972
disk , err := gceCS .CloudProvider .GetDisk (ctx , project , volKey , gce .GCEAPIVersionV1 )
965
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (disk )
973
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (disk )
966
974
if err != nil {
967
975
if gce .IsGCENotFoundError (err ) {
968
976
return nil , status .Errorf (codes .NotFound , "CreateSnapshot could not find disk %v: %v" , volKey .String (), err .Error ())
@@ -1191,8 +1199,9 @@ func (gceCS *GCEControllerServer) DeleteSnapshot(ctx context.Context, req *csi.D
1191
1199
var err error
1192
1200
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
1193
1201
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
1202
+ enableStoragePools := metrics .DefaultEnableStoragePools
1194
1203
defer func () {
1195
- gceCS .Metrics .RecordOperationErrorMetrics ("DeleteSnapshot" , err , diskTypeForMetric , enableConfidentialCompute )
1204
+ gceCS .Metrics .RecordOperationErrorMetrics ("DeleteSnapshot" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
1196
1205
}()
1197
1206
// Validate arguments
1198
1207
snapshotID := req .GetSnapshotId ()
@@ -1281,8 +1290,9 @@ func (gceCS *GCEControllerServer) ControllerExpandVolume(ctx context.Context, re
1281
1290
var err error
1282
1291
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
1283
1292
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
1293
+ enableStoragePools := metrics .DefaultEnableStoragePools
1284
1294
defer func () {
1285
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerExpandVolume" , err , diskTypeForMetric , enableConfidentialCompute )
1295
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerExpandVolume" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
1286
1296
}()
1287
1297
volumeID := req .GetVolumeId ()
1288
1298
if len (volumeID ) == 0 {
@@ -1306,8 +1316,9 @@ func (gceCS *GCEControllerServer) ControllerExpandVolume(ctx context.Context, re
1306
1316
return nil , common .LoggedError ("ControllerExpandVolume error repairing underspecified volume key: " , err )
1307
1317
}
1308
1318
sourceDisk , err := gceCS .CloudProvider .GetDisk (ctx , project , volKey , gce .GCEAPIVersionV1 )
1309
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (sourceDisk )
1319
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (sourceDisk )
1310
1320
resizedGb , err := gceCS .CloudProvider .ResizeDisk (ctx , project , volKey , reqBytes )
1321
+
1311
1322
if err != nil {
1312
1323
return nil , common .LoggedError ("ControllerExpandVolume failed to resize disk: " , err )
1313
1324
}
0 commit comments