mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
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:
parent
fb7dc13dfe
commit
b4dbffa316
@ -198,7 +198,7 @@ func FilesystemNodeGetVolumeStats(ctx context.Context, targetPath string) (*csi.
|
|||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return nil, status.Errorf(codes.InvalidArgument, "targetpath %s does not exist", targetPath)
|
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 {
|
if !isMnt {
|
||||||
return nil, status.Errorf(codes.InvalidArgument, "targetpath %s is not mounted", targetPath)
|
return nil, status.Errorf(codes.InvalidArgument, "targetpath %s is not mounted", targetPath)
|
||||||
|
@ -28,8 +28,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"google.golang.org/grpc/status"
|
|
||||||
"k8s.io/apimachinery/pkg/util/validation"
|
"k8s.io/apimachinery/pkg/util/validation"
|
||||||
"k8s.io/cloud-provider/volume/helpers"
|
"k8s.io/cloud-provider/volume/helpers"
|
||||||
"k8s.io/utils/mount"
|
"k8s.io/utils/mount"
|
||||||
@ -276,7 +274,7 @@ func IsMountPoint(p string) (bool, error) {
|
|||||||
dummyMount := mount.New("")
|
dummyMount := mount.New("")
|
||||||
notMnt, err := dummyMount.IsLikelyNotMountPoint(p)
|
notMnt, err := dummyMount.IsLikelyNotMountPoint(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, status.Error(codes.Internal, err.Error())
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return !notMnt, nil
|
return !notMnt, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user