From 1ba160afdb4db124d1dbb081c0ecaf2096121ab2 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 30 Nov 2020 15:50:07 +0530 Subject: [PATCH] cephfs: handle invalid error in subvolume info go ceph returns NotImplementedError for invalid commands,cephcsi is using errors.As to find out the error. Signed-off-by: Madhu Rajanna --- internal/cephfs/volume.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/cephfs/volume.go b/internal/cephfs/volume.go index e3944add4..5309368e3 100644 --- a/internal/cephfs/volume.go +++ b/internal/cephfs/volume.go @@ -88,8 +88,9 @@ func (vo *volumeOptions) getSubVolumeInfo(ctx context.Context, volID volumeID) ( if errors.Is(err, rados.ErrNotFound) { return nil, ErrVolumeNotFound } - // In case the error is other than invalid command return error to the caller. - if !strings.Contains(err.Error(), invalidCommand) { + // In case the error is invalid command return error to the caller. + var invalid fsAdmin.NotImplementedError + if errors.As(err, &invalid) { return nil, ErrInvalidCommand }