Skip to content

Commit

Permalink
rgw : setting max number of buckets for users via ceph.conf option
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vumrao committed Sep 3, 2015
1 parent 8b62083 commit f65267c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/common/config_opts.h
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/rgw/rgw_admin.cc
Expand Up @@ -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";
Expand Down
5 changes: 3 additions & 2 deletions src/rgw/rgw_rest_user.cc
Expand Up @@ -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;

Expand All @@ -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);

Expand Down Expand Up @@ -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"))
Expand Down
15 changes: 8 additions & 7 deletions src/rgw/rgw_user.cc
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/test/cli/radosgw-admin/help.t
Expand Up @@ -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>
Expand Down

0 comments on commit f65267c

Please sign in to comment.