From b4dbffa316b0470c4f327f5420e57d663b6c9f83 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 7 Jun 2021 11:05:08 +0530 Subject: [PATCH] util: return actual error from IsMountPoint as callers are already taking care of returing the GRPC error code return the actual error from the IsMountPoint function. Signed-off-by: Madhu Rajanna --- internal/csi-common/utils.go | 2 +- internal/util/util.go | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/csi-common/utils.go b/internal/csi-common/utils.go index 439796273..174488884 100644 --- a/internal/csi-common/utils.go +++ b/internal/csi-common/utils.go @@ -198,7 +198,7 @@ func FilesystemNodeGetVolumeStats(ctx context.Context, targetPath string) (*csi. if os.IsNotExist(err) { return nil, status.Errorf(codes.InvalidArgument, "targetpath %s does not exist", targetPath) } - return nil, err + return nil, status.Error(codes.Internal, err.Error()) } if !isMnt { return nil, status.Errorf(codes.InvalidArgument, "targetpath %s is not mounted", targetPath) diff --git a/internal/util/util.go b/internal/util/util.go index 5223afc7a..52b89fb6b 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -28,8 +28,6 @@ import ( "time" "golang.org/x/sys/unix" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "k8s.io/apimachinery/pkg/util/validation" "k8s.io/cloud-provider/volume/helpers" "k8s.io/utils/mount" @@ -276,7 +274,7 @@ func IsMountPoint(p string) (bool, error) { dummyMount := mount.New("") notMnt, err := dummyMount.IsLikelyNotMountPoint(p) if err != nil { - return false, status.Error(codes.Internal, err.Error()) + return false, err } return !notMnt, nil