diff --git a/pkg/util/cephcmds.go b/pkg/util/cephcmds.go index 387bbf3f7..f6704e66f 100644 --- a/pkg/util/cephcmds.go +++ b/pkg/util/cephcmds.go @@ -182,6 +182,11 @@ func GetOMapValue(ctx context.Context, monitors string, cr *Credentials, poolNam return "", ErrKeyNotFound{poolName + "/" + oMapName + "/" + oMapKey, err} } + if strings.Contains(stdoutanderr, "error opening pool "+ + poolName+": (2) No such file or directory") { + return "", ErrPoolNotFound{poolName, err} + } + // log other errors for troubleshooting assistance klog.Errorf(Log(ctx, "failed getting omap value for key (%s) from omap (%s) in pool (%s): (%v)"), oMapKey, oMapName, poolName, err) diff --git a/pkg/util/voljournal.go b/pkg/util/voljournal.go index c1f6735ac..5aa6e1eb3 100644 --- a/pkg/util/voljournal.go +++ b/pkg/util/voljournal.go @@ -215,7 +215,8 @@ func (cj *CSIJournal) CheckReservation(ctx context.Context, monitors string, cr if err != nil { // error should specifically be not found, for volume to be absent, any other error // is not conclusive, and we should not proceed - if _, ok := err.(ErrKeyNotFound); ok { + switch err.(type) { + case ErrKeyNotFound, ErrPoolNotFound: return "", nil } return "", err @@ -453,8 +454,10 @@ func (cj *CSIJournal) GetObjectUUIDData(ctx context.Context, monitors string, cr if err != nil { // if the key was not found, assume the default key + UUID // otherwise return error - if _, ok := err.(ErrKeyNotFound); !ok { + switch err.(type) { + default: return "", "", "", "", err + case ErrKeyNotFound, ErrPoolNotFound: } if snapSource { @@ -468,11 +471,13 @@ func (cj *CSIJournal) GetObjectUUIDData(ctx context.Context, monitors string, cr encryptionKmsConfig, err = GetOMapValue(ctx, monitors, cr, pool, cj.namespace, cj.cephUUIDDirectoryPrefix+objectUUID, cj.encryptKMSKey) if err != nil { - if _, ok := err.(ErrKeyNotFound); !ok { + // ErrKeyNotFound means no encryption KMS was used + switch err.(type) { + default: return "", "", "", "", fmt.Errorf("OMapVal for %s/%s failed to get encryption KMS value: %s", pool, cj.cephUUIDDirectoryPrefix+objectUUID, err) + case ErrKeyNotFound, ErrPoolNotFound: } - // ErrKeyNotFound means no encryption KMS was used } if snapSource {