Skip to content

Commit 8aec1f5

Browse files
committed
reassign error returned from validateStoragePools so InvalidArgument error code is recorded instead of internal error code
1 parent 586f6c8 commit 8aec1f5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/gce-pd-csi-driver/controller.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,9 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
326326

327327
err = validateStoragePools(req, params, gceCS.CloudProvider.GetDefaultProject())
328328
if err != nil {
329-
return nil, status.Errorf(codes.InvalidArgument, "CreateVolume failed to validate storage pools: %v", err)
329+
// Reassign error so that all errors are reported as InvalidArgument to RecordOperationErrorMetrics.
330+
err = status.Errorf(codes.InvalidArgument, "CreateVolume failed to validate storage pools: %v", err)
331+
return nil, err
330332
}
331333

332334
// Verify that the regional availability class is only used on regional disks.

0 commit comments

Comments
 (0)