mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
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:
parent
b7703faf37
commit
b40e8894f8
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user