@@ -205,9 +205,7 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
205
205
var err error
206
206
diskTypeForMetric := ""
207
207
defer func () {
208
- if err != nil {
209
- gceCS .Metrics .RecordOperationErrorMetrics ("CreateVolume" , err , diskTypeForMetric )
210
- }
208
+ gceCS .Metrics .RecordOperationErrorMetrics ("CreateVolume" , err , diskTypeForMetric )
211
209
}()
212
210
// Validate arguments
213
211
volumeCapabilities := req .GetVolumeCapabilities ()
@@ -444,9 +442,7 @@ func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.Del
444
442
var err error
445
443
diskTypeForMetric := ""
446
444
defer func () {
447
- if err != nil {
448
- gceCS .Metrics .RecordOperationErrorMetrics ("DeleteVolume" , err , diskTypeForMetric )
449
- }
445
+ gceCS .Metrics .RecordOperationErrorMetrics ("DeleteVolume" , err , diskTypeForMetric )
450
446
}()
451
447
// Validate arguments
452
448
volumeID := req .GetVolumeId ()
@@ -490,9 +486,7 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
490
486
var err error
491
487
diskTypeForMetric := ""
492
488
defer func () {
493
- if err != nil {
494
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerPublishVolume" , err , diskTypeForMetric )
495
- }
489
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerPublishVolume" , err , diskTypeForMetric )
496
490
}()
497
491
// Only valid requests will be accepted
498
492
_ , _ , _ , err = gceCS .validateControllerPublishVolumeRequest (ctx , req )
@@ -657,9 +651,7 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
657
651
var err error
658
652
diskTypeForMetric := ""
659
653
defer func () {
660
- if err != nil {
661
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerUnpublishVolume" , err , diskTypeForMetric )
662
- }
654
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerUnpublishVolume" , err , diskTypeForMetric )
663
655
}()
664
656
_ , _ , err = gceCS .validateControllerUnpublishVolumeRequest (ctx , req )
665
657
if err != nil {
@@ -768,9 +760,7 @@ func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context
768
760
var err error
769
761
diskTypeForMetric := ""
770
762
defer func () {
771
- if err != nil {
772
- gceCS .Metrics .RecordOperationErrorMetrics ("ValidateVolumeCapabilities" , err , diskTypeForMetric )
773
- }
763
+ gceCS .Metrics .RecordOperationErrorMetrics ("ValidateVolumeCapabilities" , err , diskTypeForMetric )
774
764
}()
775
765
if req .GetVolumeCapabilities () == nil || len (req .GetVolumeCapabilities ()) == 0 {
776
766
return nil , status .Error (codes .InvalidArgument , "Volume Capabilities must be provided" )
@@ -922,9 +912,7 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C
922
912
var err error
923
913
diskTypeForMetric := ""
924
914
defer func () {
925
- if err != nil {
926
- gceCS .Metrics .RecordOperationErrorMetrics ("CreateSnapshot" , err , diskTypeForMetric )
927
- }
915
+ gceCS .Metrics .RecordOperationErrorMetrics ("CreateSnapshot" , err , diskTypeForMetric )
928
916
}()
929
917
// Validate arguments
930
918
volumeID := req .GetSourceVolumeId ()
@@ -1159,9 +1147,7 @@ func (gceCS *GCEControllerServer) DeleteSnapshot(ctx context.Context, req *csi.D
1159
1147
var err error
1160
1148
diskTypeForMetric := ""
1161
1149
defer func () {
1162
- if err != nil {
1163
- gceCS .Metrics .RecordOperationErrorMetrics ("DeleteSnapshot" , err , diskTypeForMetric )
1164
- }
1150
+ gceCS .Metrics .RecordOperationErrorMetrics ("DeleteSnapshot" , err , diskTypeForMetric )
1165
1151
}()
1166
1152
// Validate arguments
1167
1153
snapshotID := req .GetSnapshotId ()
@@ -1250,9 +1236,7 @@ func (gceCS *GCEControllerServer) ControllerExpandVolume(ctx context.Context, re
1250
1236
var err error
1251
1237
diskTypeForMetric := ""
1252
1238
defer func () {
1253
- if err != nil {
1254
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerExpandVolume" , err , diskTypeForMetric )
1255
- }
1239
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerExpandVolume" , err , diskTypeForMetric )
1256
1240
}()
1257
1241
volumeID := req .GetVolumeId ()
1258
1242
if len (volumeID ) == 0 {
0 commit comments