@@ -196,9 +196,7 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
196
196
var err error
197
197
diskTypeForMetric := ""
198
198
defer func () {
199
- if err != nil {
200
- gceCS .Metrics .RecordOperationErrorMetrics ("CreateVolume" , err , diskTypeForMetric )
201
- }
199
+ gceCS .Metrics .RecordOperationErrorMetrics ("CreateVolume" , err , diskTypeForMetric )
202
200
}()
203
201
// Validate arguments
204
202
volumeCapabilities := req .GetVolumeCapabilities ()
@@ -430,9 +428,7 @@ func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.Del
430
428
var err error
431
429
diskTypeForMetric := ""
432
430
defer func () {
433
- if err != nil {
434
- gceCS .Metrics .RecordOperationErrorMetrics ("DeleteVolume" , err , diskTypeForMetric )
435
- }
431
+ gceCS .Metrics .RecordOperationErrorMetrics ("DeleteVolume" , err , diskTypeForMetric )
436
432
}()
437
433
// Validate arguments
438
434
volumeID := req .GetVolumeId ()
@@ -476,9 +472,7 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
476
472
var err error
477
473
diskTypeForMetric := ""
478
474
defer func () {
479
- if err != nil {
480
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerPublishVolume" , err , diskTypeForMetric )
481
- }
475
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerPublishVolume" , err , diskTypeForMetric )
482
476
}()
483
477
// Only valid requests will be accepted
484
478
_ , _ , err = gceCS .validateControllerPublishVolumeRequest (ctx , req )
@@ -638,9 +632,7 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
638
632
var err error
639
633
diskTypeForMetric := ""
640
634
defer func () {
641
- if err != nil {
642
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerUnpublishVolume" , err , diskTypeForMetric )
643
- }
635
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerUnpublishVolume" , err , diskTypeForMetric )
644
636
}()
645
637
_ , _ , err = gceCS .validateControllerUnpublishVolumeRequest (ctx , req )
646
638
if err != nil {
@@ -749,9 +741,7 @@ func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context
749
741
var err error
750
742
diskTypeForMetric := ""
751
743
defer func () {
752
- if err != nil {
753
- gceCS .Metrics .RecordOperationErrorMetrics ("ValidateVolumeCapabilities" , err , diskTypeForMetric )
754
- }
744
+ gceCS .Metrics .RecordOperationErrorMetrics ("ValidateVolumeCapabilities" , err , diskTypeForMetric )
755
745
}()
756
746
if req .GetVolumeCapabilities () == nil || len (req .GetVolumeCapabilities ()) == 0 {
757
747
return nil , status .Error (codes .InvalidArgument , "Volume Capabilities must be provided" )
@@ -908,9 +898,7 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C
908
898
var err error
909
899
diskTypeForMetric := ""
910
900
defer func () {
911
- if err != nil {
912
- gceCS .Metrics .RecordOperationErrorMetrics ("CreateSnapshot" , err , diskTypeForMetric )
913
- }
901
+ gceCS .Metrics .RecordOperationErrorMetrics ("CreateSnapshot" , err , diskTypeForMetric )
914
902
}()
915
903
// Validate arguments
916
904
volumeID := req .GetSourceVolumeId ()
@@ -1145,9 +1133,7 @@ func (gceCS *GCEControllerServer) DeleteSnapshot(ctx context.Context, req *csi.D
1145
1133
var err error
1146
1134
diskTypeForMetric := ""
1147
1135
defer func () {
1148
- if err != nil {
1149
- gceCS .Metrics .RecordOperationErrorMetrics ("DeleteSnapshot" , err , diskTypeForMetric )
1150
- }
1136
+ gceCS .Metrics .RecordOperationErrorMetrics ("DeleteSnapshot" , err , diskTypeForMetric )
1151
1137
}()
1152
1138
// Validate arguments
1153
1139
snapshotID := req .GetSnapshotId ()
@@ -1236,9 +1222,7 @@ func (gceCS *GCEControllerServer) ControllerExpandVolume(ctx context.Context, re
1236
1222
var err error
1237
1223
diskTypeForMetric := ""
1238
1224
defer func () {
1239
- if err != nil {
1240
- gceCS .Metrics .RecordOperationErrorMetrics ("ControllerExpandVolume" , err , diskTypeForMetric )
1241
- }
1225
+ gceCS .Metrics .RecordOperationErrorMetrics ("ControllerExpandVolume" , err , diskTypeForMetric )
1242
1226
}()
1243
1227
volumeID := req .GetVolumeId ()
1244
1228
if len (volumeID ) == 0 {
0 commit comments