@@ -204,9 +204,7 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
204
204
var err error
205
205
diskTypeForMetric := ""
206
206
defer func () {
207
- if err != nil {
208
- gceCS .Metrics .RecordOperationErrorMetrics ("CreateVolume" , err , diskTypeForMetric )
209
- }
207
+ gceCS .Metrics .RecordOperationErrorMetrics ("CreateVolume" , err , diskTypeForMetric )
210
208
}()
211
209
// Validate arguments
212
210
volumeCapabilities := req .GetVolumeCapabilities ()
@@ -439,9 +437,7 @@ func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.Del
439
437
var err error
440
438
diskTypeForMetric := ""
441
439
defer func () {
442
- if err != nil {
443
- gceCS .Metrics .RecordOperationErrorMetrics ("DeleteVolume" , err , diskTypeForMetric )
444
- }
440
+ gceCS .Metrics .RecordOperationErrorMetrics ("DeleteVolume" , err , diskTypeForMetric )
445
441
}()
446
442
// Validate arguments
447
443
volumeID := req .GetVolumeId ()
@@ -485,9 +481,7 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
485
481
var err error
486
482
diskTypeForMetric := ""
487
483
defer func () {
488
- if err != nil {
489
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerPublishVolume" , err , diskTypeForMetric )
490
- }
484
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerPublishVolume" , err , diskTypeForMetric )
491
485
}()
492
486
// Only valid requests will be accepted
493
487
_ , _ , err = gceCS .validateControllerPublishVolumeRequest (ctx , req )
@@ -647,9 +641,7 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
647
641
var err error
648
642
diskTypeForMetric := ""
649
643
defer func () {
650
- if err != nil {
651
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerUnpublishVolume" , err , diskTypeForMetric )
652
- }
644
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerUnpublishVolume" , err , diskTypeForMetric )
653
645
}()
654
646
_ , _ , err = gceCS .validateControllerUnpublishVolumeRequest (ctx , req )
655
647
if err != nil {
@@ -758,9 +750,7 @@ func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context
758
750
var err error
759
751
diskTypeForMetric := ""
760
752
defer func () {
761
- if err != nil {
762
- gceCS .Metrics .RecordOperationErrorMetrics ("ValidateVolumeCapabilities" , err , diskTypeForMetric )
763
- }
753
+ gceCS .Metrics .RecordOperationErrorMetrics ("ValidateVolumeCapabilities" , err , diskTypeForMetric )
764
754
}()
765
755
if req .GetVolumeCapabilities () == nil || len (req .GetVolumeCapabilities ()) == 0 {
766
756
return nil , status .Error (codes .InvalidArgument , "Volume Capabilities must be provided" )
@@ -917,9 +907,7 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C
917
907
var err error
918
908
diskTypeForMetric := ""
919
909
defer func () {
920
- if err != nil {
921
- gceCS .Metrics .RecordOperationErrorMetrics ("CreateSnapshot" , err , diskTypeForMetric )
922
- }
910
+ gceCS .Metrics .RecordOperationErrorMetrics ("CreateSnapshot" , err , diskTypeForMetric )
923
911
}()
924
912
// Validate arguments
925
913
volumeID := req .GetSourceVolumeId ()
@@ -1154,9 +1142,7 @@ func (gceCS *GCEControllerServer) DeleteSnapshot(ctx context.Context, req *csi.D
1154
1142
var err error
1155
1143
diskTypeForMetric := ""
1156
1144
defer func () {
1157
- if err != nil {
1158
- gceCS .Metrics .RecordOperationErrorMetrics ("DeleteSnapshot" , err , diskTypeForMetric )
1159
- }
1145
+ gceCS .Metrics .RecordOperationErrorMetrics ("DeleteSnapshot" , err , diskTypeForMetric )
1160
1146
}()
1161
1147
// Validate arguments
1162
1148
snapshotID := req .GetSnapshotId ()
@@ -1245,9 +1231,7 @@ func (gceCS *GCEControllerServer) ControllerExpandVolume(ctx context.Context, re
1245
1231
var err error
1246
1232
diskTypeForMetric := ""
1247
1233
defer func () {
1248
- if err != nil {
1249
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerExpandVolume" , err , diskTypeForMetric )
1250
- }
1234
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerExpandVolume" , err , diskTypeForMetric )
1251
1235
}()
1252
1236
volumeID := req .GetVolumeId ()
1253
1237
if len (volumeID ) == 0 {
0 commit comments