From fb7389f4788bdc2d1beb6af886085a99b8958849 Mon Sep 17 00:00:00 2001 From: Rakshith R Date: Thu, 8 Apr 2021 14:24:46 +0530 Subject: [PATCH] cephfs: add stderr to mount function errors This commit appends stderr to error in both kernel and ceph-fuse mounter functions to better be able to debug errors. Signed-off-by: Rakshith R --- internal/cephfs/volumemounter.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/cephfs/volumemounter.go b/internal/cephfs/volumemounter.go index dd7ce1d4f..0facb8de5 100644 --- a/internal/cephfs/volumemounter.go +++ b/internal/cephfs/volumemounter.go @@ -168,7 +168,7 @@ func mountFuse(ctx context.Context, mountPoint string, cr *util.Credentials, vol _, stderr, err := util.ExecCommand(ctx, "ceph-fuse", args[:]...) if err != nil { - return err + return fmt.Errorf("%w stderr: %s", err, stderr) } // Parse the output: @@ -227,7 +227,11 @@ func mountKernel(ctx context.Context, mountPoint string, cr *util.Credentials, v args = append(args, "-o", optionsStr) - return execCommandErr(ctx, "mount", args[:]...) + _, stderr, err := util.ExecCommand(ctx, "mount", args[:]...) + if err != nil { + return fmt.Errorf("%w stderr: %s", err, stderr) + } + return err } func (m *kernelMounter) mount(ctx context.Context, mountPoint string, cr *util.Credentials, volOptions *volumeOptions) error {