mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
cleanup: move ErrImageNotFound from rbd/errors to util/errors
Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
@ -68,7 +68,7 @@ func (ekrs *EncryptionKeyRotationServer) EncryptionKeyRotate(
|
||||
rbdVol, err := mgr.GetVolumeByID(ctx, volID)
|
||||
if err != nil {
|
||||
switch {
|
||||
case errors.Is(err, rbd.ErrImageNotFound):
|
||||
case errors.Is(err, util.ErrImageNotFound):
|
||||
err = status.Errorf(codes.NotFound, "volume ID %s not found", volID)
|
||||
case errors.Is(err, util.ErrPoolNotFound):
|
||||
log.ErrorLog(ctx, "failed to get backend volume for %s: %v", volID, err)
|
||||
|
@ -651,7 +651,7 @@ func (rs *ReplicationServer) ResyncVolume(ctx context.Context,
|
||||
sts, err := mirror.GetGlobalMirroringStatus(ctx)
|
||||
if err != nil {
|
||||
// the image gets recreated after issuing resync
|
||||
if errors.Is(err, corerbd.ErrImageNotFound) {
|
||||
if errors.Is(err, util.ErrImageNotFound) {
|
||||
// caller retries till RBD syncs an initial version of the image to
|
||||
// report its status in the resync call. Ideally, this line will not
|
||||
// be executed as the error would get returned due to getMirroringInfo
|
||||
@ -785,7 +785,7 @@ func getGRPCError(err error) error {
|
||||
}
|
||||
|
||||
errorStatusMap := map[error]codes.Code{
|
||||
corerbd.ErrImageNotFound: codes.NotFound,
|
||||
util.ErrImageNotFound: codes.NotFound,
|
||||
util.ErrPoolNotFound: codes.NotFound,
|
||||
corerbd.ErrInvalidArgument: codes.InvalidArgument,
|
||||
corerbd.ErrFlattenInProgress: codes.Aborted,
|
||||
@ -835,7 +835,7 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
|
||||
log.ErrorLog(ctx, "failed to get volume with id %q: %v", volumeID, err)
|
||||
|
||||
switch {
|
||||
case errors.Is(err, corerbd.ErrImageNotFound):
|
||||
case errors.Is(err, util.ErrImageNotFound):
|
||||
err = status.Error(codes.NotFound, err.Error())
|
||||
case errors.Is(err, util.ErrPoolNotFound):
|
||||
err = status.Error(codes.NotFound, err.Error())
|
||||
@ -872,7 +872,7 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, "failed to get status for mirror %q: %v", mirror, err)
|
||||
|
||||
if errors.Is(err, corerbd.ErrImageNotFound) {
|
||||
if errors.Is(err, util.ErrImageNotFound) {
|
||||
return nil, status.Error(codes.Aborted, err.Error())
|
||||
}
|
||||
|
||||
|
@ -597,8 +597,8 @@ func TestGetGRPCError(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "ErrImageNotFound",
|
||||
err: corerbd.ErrImageNotFound,
|
||||
expectedErr: status.Error(codes.NotFound, corerbd.ErrImageNotFound.Error()),
|
||||
err: util.ErrImageNotFound,
|
||||
expectedErr: status.Error(codes.NotFound, util.ErrImageNotFound.Error()),
|
||||
},
|
||||
{
|
||||
name: "ErrPoolNotFound",
|
||||
|
Reference in New Issue
Block a user