Skip to content

Commit

Permalink
Fix bug: if the snapshot is no longer in engine CR, don't block the
Browse files Browse the repository at this point in the history
removal process

Longhorn-6298

Signed-off-by: Phan Le <phan.le@suse.com>
(cherry picked from commit a5b67e5)
  • Loading branch information
PhanLe1010 authored and David Ko committed Jul 12, 2023
1 parent db73ba9 commit 2e08208
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controller/snapshot_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ func (sc *SnapshotController) reconcile(snapshotName string) (err error) {
}
}()

if _, ok := snapshot.Status.Children["volume-head"]; ok && snapshot.Status.MarkRemoved {
_, snapshotExistInEngineCR := engine.Status.Snapshots[snapshot.Name]
if _, hasVolumeHeadChild := snapshot.Status.Children["volume-head"]; snapshotExistInEngineCR && hasVolumeHeadChild && snapshot.Status.MarkRemoved {
// This snapshot is the parent of volume-head, so it cannot be purged immediately.
// We do not want to keep the volume stuck in attached state.
return sc.handleAttachmentTicketDeletion(snapshot)
Expand Down

0 comments on commit 2e08208

Please sign in to comment.