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 <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2021-06-07 11:05:08 +05:30 committed by mergify[bot]
parent fb7dc13dfe
commit b4dbffa316
2 changed files with 2 additions and 4 deletions

View File

@ -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)

View File

@ -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