mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
cleanup: move internal/rbd/errors.go to internal/rbd/errors pacakge
Signed-off-by: Praveen M <m.praveen@ibm.com>
(cherry picked from commit 5cbc14454a
)
# Conflicts:
# internal/csi-addons/rbd/encryptionkeyrotation.go
# internal/csi-addons/rbd/reclaimspace.go
# internal/csi-addons/rbd/replication.go
# internal/csi-addons/rbd/replication_test.go
# internal/rbd/clone.go
# internal/rbd/controllerserver.go
# internal/rbd/group/util.go
# internal/rbd/group/util_test.go
# internal/rbd/manager.go
# internal/rbd/rbd_journal.go
# internal/rbd/rbd_util.go
# internal/rbd/rbd_util_test.go
# internal/rbd/snapshot.go
# internal/util/errors.go
This commit is contained in:
@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ceph/ceph-csi/internal/journal"
|
||||
rbderrors "github.com/ceph/ceph-csi/internal/rbd/errors"
|
||||
"github.com/ceph/ceph-csi/internal/util"
|
||||
"github.com/ceph/ceph-csi/internal/util/k8s"
|
||||
"github.com/ceph/ceph-csi/internal/util/log"
|
||||
@ -172,10 +173,14 @@ func checkSnapCloneExists(
|
||||
// Fetch on-disk image attributes
|
||||
err = vol.getImageInfo()
|
||||
if err != nil {
|
||||
<<<<<<< HEAD
|
||||
if errors.Is(err, ErrImageNotFound) {
|
||||
=======
|
||||
if errors.Is(err, rbderrors.ErrImageNotFound) {
|
||||
>>>>>>> 5cbc1445 (cleanup: move internal/rbd/errors.go to internal/rbd/errors pacakge)
|
||||
err = parentVol.deleteSnapshot(ctx, rbdSnap)
|
||||
if err != nil {
|
||||
if !errors.Is(err, ErrSnapNotFound) {
|
||||
if !errors.Is(err, rbderrors.ErrSnapNotFound) {
|
||||
log.ErrorLog(ctx, "failed to delete snapshot %s: %v", rbdSnap, err)
|
||||
|
||||
return false, err
|
||||
@ -203,7 +208,7 @@ func checkSnapCloneExists(
|
||||
|
||||
// check snapshot exists if not create it
|
||||
err = vol.checkSnapExists(rbdSnap)
|
||||
if errors.Is(err, ErrSnapNotFound) {
|
||||
if errors.Is(err, rbderrors.ErrSnapNotFound) {
|
||||
// create snapshot
|
||||
sErr := vol.createSnapshot(ctx, rbdSnap)
|
||||
if sErr != nil {
|
||||
@ -298,7 +303,11 @@ func (rv *rbdVolume) Exists(ctx context.Context, parentVol *rbdVolume) (bool, er
|
||||
// Fetch on-disk image attributes and compare against request
|
||||
err = rv.getImageInfo()
|
||||
switch {
|
||||
<<<<<<< HEAD
|
||||
case errors.Is(err, ErrImageNotFound) && parentVol != nil:
|
||||
=======
|
||||
case errors.Is(err, rbderrors.ErrImageNotFound) && parentVol != nil:
|
||||
>>>>>>> 5cbc1445 (cleanup: move internal/rbd/errors.go to internal/rbd/errors pacakge)
|
||||
// Need to check cloned info here not on createvolume
|
||||
found, cErr := rv.checkCloneImage(ctx, parentVol)
|
||||
if cErr != nil {
|
||||
@ -312,7 +321,11 @@ func (rv *rbdVolume) Exists(ctx context.Context, parentVol *rbdVolume) (bool, er
|
||||
return false, err
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
case errors.Is(err, ErrImageNotFound) && parentVol == nil:
|
||||
=======
|
||||
case errors.Is(err, rbderrors.ErrImageNotFound) && parentVol == nil:
|
||||
>>>>>>> 5cbc1445 (cleanup: move internal/rbd/errors.go to internal/rbd/errors pacakge)
|
||||
// image not found, undo the reservation
|
||||
err = j.UndoReservation(ctx, rv.JournalPool, rv.Pool, rv.RbdImageName, rv.RequestName)
|
||||
|
||||
@ -330,7 +343,7 @@ func (rv *rbdVolume) Exists(ctx context.Context, parentVol *rbdVolume) (bool, er
|
||||
// size checks
|
||||
if rv.VolSize < requestSize {
|
||||
return false, fmt.Errorf("%w: image with the same name (%s) but with different size already exists",
|
||||
ErrVolNameConflict, rv.RbdImageName)
|
||||
rbderrors.ErrVolNameConflict, rv.RbdImageName)
|
||||
}
|
||||
// TODO: We should also ensure image features and format is the same
|
||||
|
||||
@ -598,7 +611,7 @@ func RegenerateJournal(
|
||||
err = vi.DecomposeCSIID(rbdVol.VolID)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("%w: error decoding volume ID (%w) (%s)",
|
||||
ErrInvalidVolID, err, rbdVol.VolID)
|
||||
rbderrors.ErrInvalidVolID, err, rbdVol.VolID)
|
||||
}
|
||||
|
||||
rbdVol.Owner = owner
|
||||
|
Reference in New Issue
Block a user