From: VinayBhaskar-V Date: Fri, 8 Aug 2025 13:00:34 +0000 (+0000) Subject: rbd-mirror: Allow group disable without --force when in PROMOTION_STATE_UNKNOWN X-Git-Tag: testing/wip-pdonnell-testing-20260323.122957-tentacle~706 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d0ce0c828ba5e4f5067557299ff801a3b9dffe15;p=ceph-ci.git rbd-mirror: Allow group disable without --force when in PROMOTION_STATE_UNKNOWN With the earlier version disabling a primary group with promotion state PROMOTION_STATE_UNKNOWN requires a force flag which deviates from the existing behavior of standalone images. This change aligns group disable behavior with that of standalone images by allowing primary groups in PROMOTION_STATE_UNKNOWN state to be disabled without the force flag. Signed-off-by: VinayBhaskar-V Resolves: rhbz#2396582 --- diff --git a/src/librbd/api/Mirror.cc b/src/librbd/api/Mirror.cc index caf4a19de30..8fc17dca77f 100644 --- a/src/librbd/api/Mirror.cc +++ b/src/librbd/api/Mirror.cc @@ -3037,7 +3037,10 @@ int Mirror::group_disable(IoCtx& group_ioctx, const char *group_name, return r; } - if (promotion_state != mirror::PROMOTION_STATE_PRIMARY && !force) { + bool is_primary = (promotion_state == mirror::PROMOTION_STATE_PRIMARY || + promotion_state == mirror::PROMOTION_STATE_UNKNOWN); + + if (!is_primary && !force) { lderr(cct) << "mirrored group " << group_name << " is not primary, add force option to disable mirroring" << dendl;