@@ -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 ()
@@ -457,8 +458,9 @@ func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.Del
457
458
var err error
458
459
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
459
460
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
461
+ enableStoragePools := metrics .DefaultEnableStoragePools
460
462
defer func () {
461
- gceCS .Metrics .RecordOperationErrorMetrics ("DeleteVolume" , err , diskTypeForMetric , enableConfidentialCompute )
463
+ gceCS .Metrics .RecordOperationErrorMetrics ("DeleteVolume" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
462
464
}()
463
465
// Validate arguments
464
466
volumeID := req .GetVolumeId ()
@@ -488,7 +490,7 @@ func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.Del
488
490
}
489
491
defer gceCS .volumeLocks .Release (volumeID )
490
492
disk , _ := gceCS .CloudProvider .GetDisk (ctx , project , volKey , gce .GCEAPIVersionV1 )
491
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (disk )
493
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (disk )
492
494
err = gceCS .CloudProvider .DeleteDisk (ctx , project , volKey )
493
495
if err != nil {
494
496
return nil , common .LoggedError ("Failed to delete disk: " , err )
@@ -502,8 +504,9 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
502
504
var err error
503
505
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
504
506
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
507
+ enableStoragePools := metrics .DefaultEnableStoragePools
505
508
defer func () {
506
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerPublishVolume" , err , diskTypeForMetric , enableConfidentialCompute )
509
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerPublishVolume" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
507
510
}()
508
511
// Only valid requests will be accepted
509
512
_ , _ , _ , err = gceCS .validateControllerPublishVolumeRequest (ctx , req )
@@ -517,7 +520,7 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
517
520
}
518
521
519
522
resp , err , disk := gceCS .executeControllerPublishVolume (ctx , req )
520
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (disk )
523
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (disk )
521
524
if err != nil {
522
525
klog .Infof ("For node %s adding backoff due to error for volume %s: %v" , req .NodeId , req .VolumeId , err )
523
526
gceCS .errorBackoff .next (backoffId , common .CodeForError (err ))
@@ -603,9 +606,9 @@ func (gceCS *GCEControllerServer) executeControllerPublishVolume(ctx context.Con
603
606
disk , err := gceCS .CloudProvider .GetDisk (ctx , project , volKey , gce .GCEAPIVersionV1 )
604
607
if err != nil {
605
608
if gce .IsGCENotFoundError (err ) {
606
- return nil , status .Errorf (codes .NotFound , "Could not find disk %v: %v" , volKey .String (), err .Error ()), disk
609
+ return nil , status .Errorf (codes .NotFound , "ControllerPublishVolume could not find disk %v: %v" , volKey .String (), err .Error ()), disk
607
610
}
608
- return nil , common .LoggedError ("Failed to getDisk: " , err ), disk
611
+ return nil , common .LoggedError ("ControllerPublishVolume, failed to getDisk: " , err ), disk
609
612
}
610
613
instanceZone , instanceName , err := common .NodeIDToZoneAndName (nodeID )
611
614
if err != nil {
@@ -667,8 +670,9 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
667
670
var err error
668
671
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
669
672
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
673
+ enableStoragePools := metrics .DefaultEnableStoragePools
670
674
defer func () {
671
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerUnpublishVolume" , err , diskTypeForMetric , enableConfidentialCompute )
675
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerUnpublishVolume" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
672
676
}()
673
677
_ , _ , err = gceCS .validateControllerUnpublishVolumeRequest (ctx , req )
674
678
if err != nil {
@@ -681,7 +685,7 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
681
685
return nil , status .Errorf (gceCS .errorBackoff .code (backoffId ), "ControllerUnpublish not permitted on node %q due to backoff condition" , req .NodeId )
682
686
}
683
687
resp , err , disk := gceCS .executeControllerUnpublishVolume (ctx , req )
684
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (disk )
688
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (disk )
685
689
if err != nil {
686
690
klog .Infof ("For node %s adding backoff due to error for volume %s: %v" , req .NodeId , req .VolumeId , err )
687
691
gceCS .errorBackoff .next (backoffId , common .CodeForError (err ))
@@ -776,8 +780,9 @@ func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context
776
780
var err error
777
781
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
778
782
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
783
+ enableStoragePools := metrics .DefaultEnableStoragePools
779
784
defer func () {
780
- gceCS .Metrics .RecordOperationErrorMetrics ("ValidateVolumeCapabilities" , err , diskTypeForMetric , enableConfidentialCompute )
785
+ gceCS .Metrics .RecordOperationErrorMetrics ("ValidateVolumeCapabilities" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
781
786
}()
782
787
if req .GetVolumeCapabilities () == nil || len (req .GetVolumeCapabilities ()) == 0 {
783
788
return nil , status .Error (codes .InvalidArgument , "Volume Capabilities must be provided" )
@@ -804,12 +809,12 @@ func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context
804
809
defer gceCS .volumeLocks .Release (volumeID )
805
810
806
811
disk , err := gceCS .CloudProvider .GetDisk (ctx , project , volKey , gce .GCEAPIVersionV1 )
807
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (disk )
812
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (disk )
808
813
if err != nil {
809
814
if gce .IsGCENotFoundError (err ) {
810
- return nil , status .Errorf (codes .NotFound , "Could not find disk %v: %v" , volKey .Name , err .Error ())
815
+ return nil , status .Errorf (codes .NotFound , "ValidateVolumeCapabilities could not find disk %v: %v" , volKey .Name , err .Error ())
811
816
}
812
- return nil , common .LoggedError ("Failed to getDisk: " , err )
817
+ return nil , common .LoggedError ("ValidateVolumeCapabilities, failed to getDisk: " , err )
813
818
}
814
819
815
820
// Check volume capabilities supported by PD. These are the same for any PD
@@ -939,8 +944,9 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C
939
944
var err error
940
945
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
941
946
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
947
+ enableStoragePools := metrics .DefaultEnableStoragePools
942
948
defer func () {
943
- gceCS .Metrics .RecordOperationErrorMetrics ("CreateSnapshot" , err , diskTypeForMetric , enableConfidentialCompute )
949
+ gceCS .Metrics .RecordOperationErrorMetrics ("CreateSnapshot" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
944
950
}()
945
951
// Validate arguments
946
952
volumeID := req .GetSourceVolumeId ()
@@ -962,7 +968,7 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C
962
968
963
969
// Check if volume exists
964
970
disk , err := gceCS .CloudProvider .GetDisk (ctx , project , volKey , gce .GCEAPIVersionV1 )
965
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (disk )
971
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (disk )
966
972
if err != nil {
967
973
if gce .IsGCENotFoundError (err ) {
968
974
return nil , status .Errorf (codes .NotFound , "CreateSnapshot could not find disk %v: %v" , volKey .String (), err .Error ())
@@ -1191,8 +1197,9 @@ func (gceCS *GCEControllerServer) DeleteSnapshot(ctx context.Context, req *csi.D
1191
1197
var err error
1192
1198
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
1193
1199
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
1200
+ enableStoragePools := metrics .DefaultEnableStoragePools
1194
1201
defer func () {
1195
- gceCS .Metrics .RecordOperationErrorMetrics ("DeleteSnapshot" , err , diskTypeForMetric , enableConfidentialCompute )
1202
+ gceCS .Metrics .RecordOperationErrorMetrics ("DeleteSnapshot" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
1196
1203
}()
1197
1204
// Validate arguments
1198
1205
snapshotID := req .GetSnapshotId ()
@@ -1281,8 +1288,9 @@ func (gceCS *GCEControllerServer) ControllerExpandVolume(ctx context.Context, re
1281
1288
var err error
1282
1289
diskTypeForMetric := metrics .DefaultDiskTypeForMetric
1283
1290
enableConfidentialCompute := metrics .DefaultEnableConfidentialCompute
1291
+ enableStoragePools := metrics .DefaultEnableStoragePools
1284
1292
defer func () {
1285
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerExpandVolume" , err , diskTypeForMetric , enableConfidentialCompute )
1293
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerExpandVolume" , err , diskTypeForMetric , enableConfidentialCompute , enableStoragePools )
1286
1294
}()
1287
1295
volumeID := req .GetVolumeId ()
1288
1296
if len (volumeID ) == 0 {
@@ -1306,8 +1314,9 @@ func (gceCS *GCEControllerServer) ControllerExpandVolume(ctx context.Context, re
1306
1314
return nil , common .LoggedError ("ControllerExpandVolume error repairing underspecified volume key: " , err )
1307
1315
}
1308
1316
sourceDisk , err := gceCS .CloudProvider .GetDisk (ctx , project , volKey , gce .GCEAPIVersionV1 )
1309
- diskTypeForMetric , enableConfidentialCompute = metrics .GetMetricParameters (sourceDisk )
1317
+ diskTypeForMetric , enableConfidentialCompute , enableStoragePools = metrics .GetMetricParameters (sourceDisk )
1310
1318
resizedGb , err := gceCS .CloudProvider .ResizeDisk (ctx , project , volKey , reqBytes )
1319
+
1311
1320
if err != nil {
1312
1321
return nil , common .LoggedError ("ControllerExpandVolume failed to resize disk: " , err )
1313
1322
}
@@ -1627,13 +1636,13 @@ func getZonesFromTopology(topList []*csi.Topology) ([]string, error) {
1627
1636
zones := []string {}
1628
1637
for _ , top := range topList {
1629
1638
if top .GetSegments () == nil {
1630
- return nil , fmt .Errorf ("topologies specified but no segments" )
1639
+ return nil , fmt .Errorf ("preferred topologies specified but no segments" )
1631
1640
}
1632
1641
1633
1642
// GCE PD cloud provider Create has no restrictions so just create in top preferred zone
1634
1643
zone , err := getZoneFromSegment (top .GetSegments ())
1635
1644
if err != nil {
1636
- return nil , fmt .Errorf ("could not get zone from topology: %w" , err )
1645
+ return nil , fmt .Errorf ("could not get zone from preferred topology: %w" , err )
1637
1646
}
1638
1647
zones = append (zones , zone )
1639
1648
}
0 commit comments