From: J. Eric Ivancich Date: Fri, 27 Sep 2019 00:54:42 +0000 (-0400) Subject: rgw: prevent bucket reshard scheduling if bucket is resharding X-Git-Tag: v13.2.9~74^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3ebeb256752049e8c6515a884a09b87450240272;p=ceph.git rgw: prevent bucket reshard scheduling if bucket is resharding radosgw-admin should prevent a bucket from being added to the reshard list if it is currently being resharded. Signed-off-by: J. Eric Ivancich (cherry picked from commit f24a7eecdea70ff971f24f6f12748db80b1a43b2) --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 367bf746514d..068d900865fd 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -23,6 +23,7 @@ #include "include/util.h" +#include "cls/rgw/cls_rgw_types.h" #include "cls/rgw/cls_rgw_client.h" #include "global/global_init.h" @@ -2564,6 +2565,13 @@ int check_reshard_bucket_params(RGWRados *store, return ret; } + if (bucket_info.reshard_status != CLS_RGW_RESHARD_NOT_RESHARDING) { + // if in_progress or done then we have an old BucketInfo + cerr << "ERROR: the bucket is currently undergoing resharding and " + "cannot be added to the reshard list at this time" << std::endl; + return -EBUSY; + } + int num_source_shards = (bucket_info.num_shards > 0 ? bucket_info.num_shards : 1); if (num_shards <= num_source_shards && !yes_i_really_mean_it) {