]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw : setting max number of buckets for users via ceph.conf option 6166/head
authorVikhyat Umrao <vumrao@redhat.com>
Thu, 3 Sep 2015 06:32:05 +0000 (12:02 +0530)
committerLoic Dachary <ldachary@redhat.com>
Fri, 2 Oct 2015 15:22:18 +0000 (17:22 +0200)
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>
(cherry picked from commit f65267c96cbd4cd25036b6bf399692e77bbb9436)

Conflicts:
src/rgw/rgw_admin.cc: usage is on cerr in hammer, not cout

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 92b02d3f698976207b791e88808806cc9451d4b2..2c6eb1d63afcfd38bf61c5e3a894ea9957ffd72b 100644 (file)
@@ -1047,6 +1047,7 @@ OPTION(rgw_user_quota_sync_wait_time, OPT_INT, 3600 * 24) // min time between tw
 OPTION(rgw_multipart_min_part_size, OPT_INT, 5 * 1024 * 1024) // min size for each part (except for last one) 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 dbc26a973c912384ab9aad9c59b4ed3e868e774f..b3afa7d50cc377117d4e056c8eaa2d8b7e113a58 100644 (file)
@@ -125,6 +125,7 @@ void _usage()
   cerr << "   --access=<access>         Set access permissions for sub-user, should be one\n";
   cerr << "                             of read, write, readwrite, full\n";
   cerr << "   --display-name=<name>\n";
+  cerr << "   --max_buckets             max number of buckets for a user\n";
   cerr << "   --system                  set the system flag on the user\n";
   cerr << "   --bucket=<bucket>\n";
   cerr << "   --pool=<pool>\n";
index fc46ff6646fad6c7f742bd1638abe47452be7542..5e618c419a9c9719871fcbfa11d4b39244d9067b 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 1e06e858a99d4190b37298664b9baa0351246ce0..1e122df063b74d5a619515d1a049db6545b575f8 100644 (file)
@@ -1767,7 +1767,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;
 
@@ -1973,13 +1979,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 33aee1d5eb332ffa70e72407c29a208c23081bd3..a79a53506713ff60c84e882a32650ae65ce3bce4 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>