cephfs: use errors.As instead of errors.Is

As we need to compare the error type instead
of the error value we need to use errors.As
to check the API is implemented or not.

fixes: #3347

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2022-10-11 13:52:26 +02:00 committed by mergify[bot]
parent b7703faf37
commit b40e8894f8
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ func (s *subVolumeClient) supportsSubVolMetadata() bool {
func (s *subVolumeClient) isUnsupportedSubVolMetadata(err error) bool { func (s *subVolumeClient) isUnsupportedSubVolMetadata(err error) bool {
var invalid fsAdmin.NotImplementedError var invalid fsAdmin.NotImplementedError
if err != nil && errors.Is(err, &invalid) { if err != nil && errors.As(err, &invalid) {
// In case the error is other than invalid command return error to the caller. // In case the error is other than invalid command return error to the caller.
clusterAdditionalInfo[s.clusterID].subVolMetadataState = unsupported clusterAdditionalInfo[s.clusterID].subVolMetadataState = unsupported

View File

@ -36,7 +36,7 @@ func (s *snapshotClient) supportsSubVolSnapMetadata() bool {
func (s *snapshotClient) isUnsupportedSubVolSnapMetadata(err error) bool { func (s *snapshotClient) isUnsupportedSubVolSnapMetadata(err error) bool {
var invalid fsAdmin.NotImplementedError var invalid fsAdmin.NotImplementedError
if err != nil && errors.Is(err, &invalid) { if err != nil && errors.As(err, &invalid) {
// In case the error is other than invalid command return error to // In case the error is other than invalid command return error to
// the caller. // the caller.
clusterAdditionalInfo[s.clusterID].subVolSnapshotMetadataState = unsupported clusterAdditionalInfo[s.clusterID].subVolSnapshotMetadataState = unsupported