]> git.apps.os.sepia.ceph.com Git - ceph-ci.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)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 28 Sep 2025 18:25:04 +0000 (20:25 +0200)
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 ccf53a2ba932f8e83f22ab4b7c012e6c20cabe93..a12fa319cd6cddeadec03007ddd8892f572edac4 100644 (file)
@@ -376,8 +376,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 0a3aa6a320bc6acd1138530c0c351aa23a066d9a..6b3f8faef4a1b91fbdeff022b3dc0ced443fbdd6 100644 (file)
@@ -2970,9 +2970,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;
   }