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 <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-11-30 15:50:07 +05:30 committed by mergify[bot]
parent 66eb3b7525
commit 1ba160afdb

View File

@ -88,8 +88,9 @@ func (vo *volumeOptions) getSubVolumeInfo(ctx context.Context, volID volumeID) (
if errors.Is(err, rados.ErrNotFound) { if errors.Is(err, rados.ErrNotFound) {
return nil, ErrVolumeNotFound return nil, ErrVolumeNotFound
} }
// In case the error is other than invalid command return error to the caller. // In case the error is invalid command return error to the caller.
if !strings.Contains(err.Error(), invalidCommand) { var invalid fsAdmin.NotImplementedError
if errors.As(err, &invalid) {
return nil, ErrInvalidCommand return nil, ErrInvalidCommand
} }