]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-mirror: skip validation of primary demote snapshots
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Mon, 22 Sep 2025 14:36:40 +0000 (20:06 +0530)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 28 Sep 2025 18:25:05 +0000 (20:25 +0200)
Problem:
When a primary demotion is in progress, the demote snapshot is in an incomplete
state. However, the group replayer incorrectly attempts to validate this
snapshot using validate_local_group_snapshots(), treating the cluster as if it
were secondary. This results in the group status being incorrectly set to
up+replaying instead of up+unknown.

Solution:
Avoid validating snapshots that are in the process of being demoted on the
primary. This ensures the group replayer does not mistakenly assign an
incorrect role or state during transition.

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
src/tools/rbd_mirror/group_replayer/Replayer.cc

index d8a58ac747c88ab6b275a9b7d9a6c1c85a91bee4..fdd2826af81f2e2a433c7733b736e00887eec4cd 100644 (file)
@@ -419,7 +419,7 @@ void Replayer<I>::validate_local_group_snapshots() {
     // skip validation for primary snapshots
     auto ns = std::get_if<cls::rbd::GroupSnapshotNamespaceMirror>(
         &local_snap.snapshot_namespace);
-    if (ns != nullptr && ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY) {
+    if (ns != nullptr && ns->is_primary()) {
       continue;
     }
 
@@ -763,8 +763,7 @@ void Replayer<I>::try_create_group_snapshot(
                    << snap->id << dendl;
           create_group_snapshot(*snap, locker);
           continue;
-        } else if (next_remote_snap_ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY ||
-            next_remote_snap_ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY_DEMOTED) {
+        } else if (next_remote_snap_ns->is_primary()) {
           dout(10) << "found primary remote mirror group snapshot: "
                    << snap->id << dendl;
           create_group_snapshot(*snap, locker);