]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: prevent a non-primary group from being removed
authorVinayBhaskar-V <vvarada@redhat.com>
Thu, 17 Apr 2025 10:35:19 +0000 (16:05 +0530)
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Thu, 24 Apr 2025 15:56:39 +0000 (21:26 +0530)
also adjust the smoke test to align with the changes.

Signed-off-by: VinayBhaskar-V <vvarada@redhat.com>
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
qa/workunits/rbd/rbd_mirror_group.sh
src/librbd/api/Group.cc
src/librbd/api/Mirror.cc

index c6f04ed0e8a6a3db1f43a78a93b9ed1ed3b4836a..d76e5db3dd124803ba2f430557f2731fe89582e6 100755 (executable)
@@ -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'
index cf2b5363fc6279489c19edc8d2795ff78339fefa..5c449d95bc2d09bc87a04619ad991005fabb6bb0 100644 (file)
@@ -373,8 +373,9 @@ int Group<I>::remove(librados::IoCtx& io_ctx, const char *group_name)
     return r;
   }
 
-  r = Mirror<I>::group_disable(io_ctx, group_name, true);
+  r = Mirror<I>::group_disable(io_ctx, group_name, false);
   if (r < 0) {
+    lderr(cct) << "failed to disable mirroring: " << cpp_strerror(r) << dendl;
     return r;
   }
 
index 132c6371c80fcc64792c97afde23541e10158006..8edff23072554c99cf5ce105d723177a39f2469b 100644 (file)
@@ -2944,9 +2944,8 @@ int Mirror<I>::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;
   }