On daemon restart, the image replayer currently deletes and recreates image
snapshots if object copying has not yet started, in order to avoid missing
image state such as object-map or metadata.
This logic is unnecessary for image snapshot part of mirror group snapshots. By
the time a group snapshot reaches GROUP_SNAPSHOT_STATE_CREATED, all member
image snapshots are already guaranteed to be in the CREATED state. Deleting
such image snapshots provides no benefit and can cause group snapshots to
become stuck (in current case) waiting for such image snapshots.
Skip image snapshot deletion when the snapshot is part of a group snapshot.
A follow-up commit will address handling group snapshots that remain in
GROUP_SNAPSHOT_STATE_CREATING across a daemon restart by deleting and
allowing the syncing recreating the group snapshot as a whole.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
// the first non-primary snapshot since we know its snapshot is
// well-formed because otherwise the mirror-image-state would have
// forced an image deletion.
- m_prune_snap_ids.clear();
- m_prune_snap_ids.insert(local_snap_id);
- break;
+ if (!mirror_ns->group_spec.is_valid()) {
+ m_prune_snap_ids.clear();
+ m_prune_snap_ids.insert(local_snap_id);
+ break;
+ }
} else {
// start snap will be last complete mirror snapshot or initial
// image revision