]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-mirror: Allow group disable without --force when in PROMOTION_STATE_UNKNOWN
authorVinayBhaskar-V <vvarada@redhat.com>
Fri, 8 Aug 2025 13:00:34 +0000 (13:00 +0000)
committerIlya Dryomov <idryomov@redhat.com>
Fri, 19 Sep 2025 22:01:18 +0000 (00:01 +0200)
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 <vvarada@redhat.com>
Resolves: rhbz#2396582

src/librbd/api/Mirror.cc

index caf4a19de30b691c8a7df3fdcbcb5b2b07c3996f..8fc17dca77f219f4f0b24621d2dc92105be4cd9f 100644 (file)
@@ -3037,7 +3037,10 @@ int Mirror<I>::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;