From a0283ef7f9894e3d3ed70b3263d7682c8a86de20 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 30 Nov 2020 15:35:39 +0530 Subject: [PATCH] cephfs: use rados.ErrNotFound in getVolumeRootPathCeph go-ceph rados.ErrNotFound for not found errors,cephcsi need to check same for not found errors. Signed-off-by: Madhu Rajanna --- internal/cephfs/volume.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/cephfs/volume.go b/internal/cephfs/volume.go index b63054468..c6a3e6da7 100644 --- a/internal/cephfs/volume.go +++ b/internal/cephfs/volume.go @@ -18,6 +18,7 @@ package cephfs import ( "context" + "errors" "fmt" "path" "strings" @@ -25,6 +26,7 @@ import ( "github.com/ceph/ceph-csi/internal/util" fsAdmin "github.com/ceph/go-ceph/cephfs/admin" + "github.com/ceph/go-ceph/rados" ) var ( @@ -65,7 +67,7 @@ func (vo *volumeOptions) getVolumeRootPathCeph(ctx context.Context, volID volume svPath, err := fsa.SubVolumePath(vo.FsName, vo.SubvolumeGroup, string(volID)) if err != nil { util.ErrorLog(ctx, "failed to get the rootpath for the vol %s: %s", string(volID), err) - if strings.Contains(err.Error(), volumeNotFound) { + if errors.Is(err, rados.ErrNotFound) { return "", util.JoinErrors(ErrVolumeNotFound, err) } return "", err