mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-02-21 18:09:30 +00:00
rbd: fix bug in rbdVol.Exists() in PVC-PVC clone case
This commit fixes a bug in rbdVol.Exists() which caused
VolID not to be set in PVC-PVC clone case.
Signed-off-by: Rakshith R <rar@redhat.com>
(cherry picked from commit b05d467679
)
# Conflicts:
# internal/rbd/rbd_journal.go
This commit is contained in:
parent
000b5c488d
commit
43c3cc8de6
@ -297,24 +297,28 @@ func (rv *rbdVolume) Exists(ctx context.Context, parentVol *rbdVolume) (bool, er
|
||||
requestSize := rv.VolSize
|
||||
// Fetch on-disk image attributes and compare against request
|
||||
err = rv.getImageInfo()
|
||||
if err != nil {
|
||||
if errors.Is(err, ErrImageNotFound) {
|
||||
// Need to check cloned info here not on createvolume,
|
||||
if parentVol != nil {
|
||||
found, cErr := rv.checkCloneImage(ctx, parentVol)
|
||||
switch {
|
||||
case found && cErr == nil:
|
||||
return true, nil
|
||||
case cErr != nil:
|
||||
return false, cErr
|
||||
}
|
||||
}
|
||||
err = j.UndoReservation(ctx, rv.JournalPool, rv.Pool,
|
||||
rv.RbdImageName, rv.RequestName)
|
||||
switch {
|
||||
case errors.Is(err, ErrImageNotFound) && parentVol != nil:
|
||||
// Need to check cloned info here not on createvolume
|
||||
found, cErr := rv.checkCloneImage(ctx, parentVol)
|
||||
if cErr != nil {
|
||||
return false, cErr
|
||||
}
|
||||
|
||||
if !found {
|
||||
// image not found, undo the reservation
|
||||
err = j.UndoReservation(ctx, rv.JournalPool, rv.Pool, rv.RbdImageName, rv.RequestName)
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
case errors.Is(err, ErrImageNotFound) && parentVol == nil:
|
||||
// image not found, undo the reservation
|
||||
err = j.UndoReservation(ctx, rv.JournalPool, rv.Pool, rv.RbdImageName, rv.RequestName)
|
||||
|
||||
return false, err
|
||||
|
||||
case err != nil:
|
||||
return false, err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user