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 <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-11-30 15:35:39 +05:30 committed by mergify[bot]
parent b40d561228
commit a0283ef7f9

View File

@ -18,6 +18,7 @@ package cephfs
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"path" "path"
"strings" "strings"
@ -25,6 +26,7 @@ import (
"github.com/ceph/ceph-csi/internal/util" "github.com/ceph/ceph-csi/internal/util"
fsAdmin "github.com/ceph/go-ceph/cephfs/admin" fsAdmin "github.com/ceph/go-ceph/cephfs/admin"
"github.com/ceph/go-ceph/rados"
) )
var ( var (
@ -65,7 +67,7 @@ func (vo *volumeOptions) getVolumeRootPathCeph(ctx context.Context, volID volume
svPath, err := fsa.SubVolumePath(vo.FsName, vo.SubvolumeGroup, string(volID)) svPath, err := fsa.SubVolumePath(vo.FsName, vo.SubvolumeGroup, string(volID))
if err != nil { if err != nil {
util.ErrorLog(ctx, "failed to get the rootpath for the vol %s: %s", string(volID), err) 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 "", util.JoinErrors(ErrVolumeNotFound, err)
} }
return "", err return "", err