]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commit
rbd-mirror: integration of the new GroupSnapshotNamespaceMirror::complete field
authorVinayBhaskar-V <vvarada@redhat.com>
Wed, 20 Aug 2025 18:30:09 +0000 (18:30 +0000)
committerIlya Dryomov <idryomov@redhat.com>
Sat, 22 Nov 2025 16:46:48 +0000 (17:46 +0100)
commit03844c150109f75cd797015eea75f54e4fb166dc
tree64720d8e035c76a2a134c22a19548d17f66d7113
parent66b1fd9ccee48dccc06bd016128c775e5acba640
rbd-mirror: integration of the new GroupSnapshotNamespaceMirror::complete field

This commit introduces the new field **complete**, of type **MirrorGroupSnapshotCompleteState** enum,
to the GroupSnapshotNamespaceMirror structure. This change is necessary to align behavior of
mirror group snapshots with that of mirror image snapshots, allowing for a precise differentiation
between a group snapshot that has been created and one that has been fully synced.

**1. Handling Old-Style Snapshots**

Decoding Old Snapshots: The original GroupSnapshotNamespaceMirror structure lacked the complete field,
which implicitly defaulted to a bool value of false upon initialization.
When an old snapshot (lacking the complete field) is decoded by an upgraded client,
the implicit default value maps to MIRROR_GROUP_SNAPSHOT_COMPLETE_IF_CREATED.

Completion Check: A snapshot is determined old by checking it's complete filed i.e
complete == MIRROR_GROUP_SNAPSHOT_COMPLETE_IF_CREATED and if it's old the sync completion
for these group snapshots is determined by checking the state field
i.e state == GROUP_SNAPSHOT_STATE_CREATED.

During a upgrade where **OSDs have not yet been updated**, the new client will be forced to create
snapshots using the old style. These snapshots will be initialized with MIRROR_GROUP_SNAPSHOT_COMPLETE_IF_CREATED
and will stay on that to prevent immediate, incorrect cleanup by the old OSDs and in this case
state field is set to **GROUP_SNAPSHOT_STATE_CREATED** only after snapshot completed it's sync.

**2. Handling New-Style Snapshots**

New snapshots are initialized with complete == **MIRROR_GROUP_SNAPSHOT_INCOMPLETE**,
state == GROUP_SNAPSHOT_STATE_CREATING. The group snapshot's state is marked as GROUP_SNAPSHOT_STATE_CREATED
as soon as its metadata is fully available and stored.

Completion Check: The snapshot's sync is confirmed only when complete == MIRROR_GROUP_SNAPSHOT_COMPLETE
along with state check (state == GROUP_SNAPSHOT_STATE_CREATED) is satisfied.

This approach ensures seamless transition and compatibility, allowing the system to correctly interpret the
synchronization status of both old and newly created group snapshots.

Signed-off-by: VinayBhaskar-V <vvarada@redhat.com>
Resolves: rhbz#2396583
24 files changed:
qa/workunits/rbd/rbd_mirror_group_simple.sh
qa/workunits/rbd/rbd_mirror_helpers.sh
src/cls/rbd/cls_rbd.cc
src/cls/rbd/cls_rbd_types.cc
src/cls/rbd/cls_rbd_types.h
src/include/rbd/librbd.h
src/librbd/api/Group.cc
src/librbd/api/Mirror.cc
src/librbd/mirror/GroupEnableRequest.cc
src/librbd/mirror/GroupGetInfoRequest.cc
src/librbd/mirror/snapshot/GroupCreatePrimaryRequest.cc
src/librbd/mirror/snapshot/GroupUnlinkPeerRequest.cc
src/pybind/rbd/c_rbd.pxd
src/pybind/rbd/mock_rbd.pxi
src/pybind/rbd/rbd.pyx
src/test/cls_rbd/test_cls_rbd.cc
src/test/librbd/test_Groups.cc
src/test/pybind/test_rbd.py
src/tools/rbd/Utils.cc
src/tools/rbd/Utils.h
src/tools/rbd/action/Group.cc
src/tools/rbd/action/MirrorGroup.cc
src/tools/rbd_mirror/group_replayer/Replayer.cc
src/tools/rbd_mirror/group_replayer/Replayer.h