Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luminous: expose --sync-stats via admin api #18439

Merged
merged 1 commit into from Nov 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/rgw/rgw_rest_user.cc
Expand Up @@ -32,6 +32,7 @@ void RGWOp_User_Info::execute()

std::string uid_str;
bool fetch_stats;
bool sync_stats;

RESTArgs::get_string(s, "uid", uid_str, &uid_str);

Expand All @@ -47,8 +48,11 @@ void RGWOp_User_Info::execute()

RESTArgs::get_bool(s, "stats", false, &fetch_stats);

RESTArgs::get_bool(s, "sync", false, &sync_stats);

op_state.set_user_id(uid);
op_state.set_fetch_stats(fetch_stats);
op_state.set_sync_stats(sync_stats);

http_ret = RGWUserAdminOp_User::info(store, op_state, flusher);
}
Expand Down
7 changes: 7 additions & 0 deletions src/rgw/rgw_user.cc
Expand Up @@ -2363,6 +2363,13 @@ int RGWUserAdminOp_User::info(RGWRados *store, RGWUserAdminOpState& op_state,
if (ret < 0)
return ret;

if (op_state.sync_stats) {
ret = rgw_user_sync_all_stats(store, info.user_id);
if (ret < 0) {
return ret;
}
}

RGWStorageStats stats;
RGWStorageStats *arg_stats = NULL;
if (op_state.fetch_stats) {
Expand Down
5 changes: 5 additions & 0 deletions src/rgw/rgw_user.h
Expand Up @@ -163,6 +163,7 @@ struct RGWUserAdminOpState {
__u8 system;
__u8 exclusive;
__u8 fetch_stats;
__u8 sync_stats;
std::string caps;
RGWObjVersionTracker objv;
uint32_t op_mask;
Expand Down Expand Up @@ -334,6 +335,10 @@ struct RGWUserAdminOpState {
fetch_stats = is_fetch_stats;
}

void set_sync_stats(__u8 is_sync_stats) {
sync_stats = is_sync_stats;
}

void set_user_info(RGWUserInfo& user_info) {
user_id = user_info.user_id;
info = user_info;
Expand Down