]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw : setting max number of buckets for users via ceph.conf option 5624/head
authorVikhyat Umrao <vumrao@redhat.com>
Thu, 3 Sep 2015 06:32:05 +0000 (12:02 +0530)
committerVikhyat Umrao <vumrao@redhat.com>
Thu, 3 Sep 2015 06:35:54 +0000 (12:05 +0530)
This patch adds a new option "rgw_user_max_buckets" for setting
max number of buckets for users via ceph.conf.

Fixes #12714

Signed-off-by: Vikhyat Umrao <vumrao@redhat.com>
src/common/config_opts.h
src/rgw/rgw_admin.cc
src/rgw/rgw_rest_user.cc
src/rgw/rgw_user.cc
src/test/cli/radosgw-admin/help.t

index f8bbdfbc0a5651a92c9c9057fc9d89884cf4f662..a1c88b196289d1617889cef5e062ce830f7228ad 100644 (file)
@@ -1123,6 +1123,7 @@ OPTION(rgw_multipart_min_part_size, OPT_INT, 5 * 1024 * 1024) // min size for ea
 OPTION(rgw_multipart_part_upload_limit, OPT_INT, 10000) // parts limit in multipart upload
 
 OPTION(rgw_olh_pending_timeout_sec, OPT_INT, 3600) // time until we retire a pending olh change
+OPTION(rgw_user_max_buckets, OPT_U32, 1000) // global option to set max buckets count for all user
 
 OPTION(mutex_perf_counter, OPT_BOOL, false) // enable/disable mutex perf counter
 OPTION(throttler_perf_counter, OPT_BOOL, true) // enable/disable throttler perf counter
index 1140cbdbbc5f8de331f12d5f5bb631e15ba36883..610275700cb83f79759fe10b543f1b72a83befa6 100644 (file)
@@ -125,6 +125,7 @@ void _usage()
   cout << "   --access=<access>         Set access permissions for sub-user, should be one\n";
   cout << "                             of read, write, readwrite, full\n";
   cout << "   --display-name=<name>\n";
+  cout << "   --max_buckets             max number of buckets for a user\n";
   cout << "   --system                  set the system flag on the user\n";
   cout << "   --bucket=<bucket>\n";
   cout << "   --pool=<pool>\n";
index 6b5d1eb286965ba6d1359052e9edf5d2bf43b242..6cd2591bfb5de202c924adbe61a7cd22d6745cb5 100644 (file)
@@ -71,6 +71,7 @@ void RGWOp_User_Create::execute()
   bool exclusive;
 
   uint32_t max_buckets;
+  uint32_t default_max_buckets = s->cct->_conf->rgw_user_max_buckets;
 
   RGWUserAdminOpState op_state;
 
@@ -83,7 +84,7 @@ void RGWOp_User_Create::execute()
   RESTArgs::get_string(s, "user-caps", caps, &caps);
   RESTArgs::get_bool(s, "generate-key", true, &gen_key);
   RESTArgs::get_bool(s, "suspended", false, &suspended);
-  RESTArgs::get_uint32(s, "max-buckets", RGW_DEFAULT_MAX_BUCKETS, &max_buckets);
+  RESTArgs::get_uint32(s, "max-buckets", default_max_buckets, &max_buckets);
   RESTArgs::get_bool(s, "system", false, &system);
   RESTArgs::get_bool(s, "exclusive", false, &exclusive);
 
@@ -122,7 +123,7 @@ void RGWOp_User_Create::execute()
     op_state.set_key_type(key_type);
   }
 
-  if (max_buckets != RGW_DEFAULT_MAX_BUCKETS)
+  if (max_buckets != default_max_buckets)
     op_state.set_max_buckets(max_buckets);
 
   if (s->info.args.exists("suspended"))
index 5a5328d8c1b4d39c423b04d2ed4d86080066fa5a..47475c3d8b5ea61da17a3a97d4eb39022f6024c1 100644 (file)
@@ -1810,7 +1810,13 @@ int RGWUser::execute_add(RGWUserAdminOpState& op_state, std::string *err_msg)
   if (!user_email.empty())
     user_info.user_email = user_email;
 
-  user_info.max_buckets = op_state.get_max_buckets();
+  CephContext *cct = store->ctx();
+  if (op_state.max_buckets_specified) {
+    user_info.max_buckets = op_state.get_max_buckets();
+  } else {
+    user_info.max_buckets = cct->_conf->rgw_user_max_buckets;
+  }
+
   user_info.suspended = op_state.get_suspension_status();
   user_info.system = op_state.system;
 
@@ -2016,13 +2022,8 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg)
   if (!display_name.empty())
     user_info.display_name = display_name;
 
-  // will be set to RGW_DEFAULT_MAX_BUCKETS by default
-  uint32_t max_buckets = op_state.get_max_buckets();
-
-  ldout(store->ctx(), 0) << "max_buckets=" << max_buckets << " specified=" << op_state.max_buckets_specified << dendl;
-
   if (op_state.max_buckets_specified)
-    user_info.max_buckets = max_buckets;
+    user_info.max_buckets = op_state.get_max_buckets();
 
   if (op_state.system_specified)
     user_info.system = op_state.system;
index fec8737541e4b024627114a111feea9df0229ab8..c9eab32c2db112af6e5ef43dba39d6ce8fae9929 100644 (file)
@@ -82,6 +82,7 @@
      --access=<access>         Set access permissions for sub-user, should be one
                                of read, write, readwrite, full
      --display-name=<name>
+     --max_buckets             max number of buckets for a user
      --system                  set the system flag on the user
      --bucket=<bucket>
      --pool=<pool>