From: VinayBhaskar-V Date: Thu, 17 Apr 2025 10:35:19 +0000 (+0530) Subject: rbd-mirror: prevent a non-primary group from being removed X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0e4b292ed309085286d3c3ab4b85e6cd4a258821;p=ceph.git rbd-mirror: prevent a non-primary group from being removed also adjust the smoke test to align with the changes. Signed-off-by: VinayBhaskar-V Signed-off-by: Prasanna Kumar Kalever --- diff --git a/qa/workunits/rbd/rbd_mirror_group.sh b/qa/workunits/rbd/rbd_mirror_group.sh index c6f04ed0e8a6a..d76e5db3dd124 100755 --- a/qa/workunits/rbd/rbd_mirror_group.sh +++ b/qa/workunits/rbd/rbd_mirror_group.sh @@ -444,7 +444,7 @@ fi wait_for_group_present ${CLUSTER1} ${POOL}/${NS1} ${group} 0 remove_image_retry ${CLUSTER2} ${POOL}/${NS1} ${image} wait_for_image_present ${CLUSTER1} ${POOL}/${NS1} ${image} 'deleted' -group_remove ${CLUSTER1} ${POOL}/${NS1}/${group} +group_remove ${CLUSTER2} ${POOL}/${NS1}/${group} wait_for_group_not_present ${CLUSTER1} ${POOL} ${NS1}/${group} mirror_group_disable ${CLUSTER2} ${POOL}/${NS2}/${group} wait_for_image_present ${CLUSTER1} ${POOL}/${NS2} ${image} 'deleted' diff --git a/src/librbd/api/Group.cc b/src/librbd/api/Group.cc index cf2b5363fc627..5c449d95bc2d0 100644 --- a/src/librbd/api/Group.cc +++ b/src/librbd/api/Group.cc @@ -373,8 +373,9 @@ int Group::remove(librados::IoCtx& io_ctx, const char *group_name) return r; } - r = Mirror::group_disable(io_ctx, group_name, true); + r = Mirror::group_disable(io_ctx, group_name, false); if (r < 0) { + lderr(cct) << "failed to disable mirroring: " << cpp_strerror(r) << dendl; return r; } diff --git a/src/librbd/api/Mirror.cc b/src/librbd/api/Mirror.cc index 132c6371c80fc..8edff23072554 100644 --- a/src/librbd/api/Mirror.cc +++ b/src/librbd/api/Mirror.cc @@ -2944,9 +2944,8 @@ int Mirror::group_disable(IoCtx& group_ioctx, const char *group_name, } if (state != cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY && !force) { - lderr(cct) << "group " << group_name - << " is not primary, disable is allowed when cluster is primary" - << " or if you know what you are doing, add a force flag" + lderr(cct) << "mirrored group " << group_name + << " is not primary, add force option to disable mirroring" << dendl; return -EINVAL; }