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