ruser = driver->get_user(info.user_id);
+ rgw_owner owner = info.user_id;
+ if (!info.account_id.empty()) {
+ ldpp_dout(dpp, 4) << "Reading stats for user account "
+ << info.account_id << dendl;
+ owner = info.account_id;
+ }
+
if (op_state.sync_stats) {
- ret = rgw_sync_all_stats(dpp, y, driver, ruser->get_id(), ruser->get_tenant());
+ ret = rgw_sync_all_stats(dpp, y, driver, owner, ruser->get_tenant());
if (ret < 0) {
return ret;
}
if (op_state.fetch_stats) {
ceph::real_time last_synced; // ignored
ceph::real_time last_updated; // ignored
- int ret = driver->load_stats(dpp, y, ruser->get_id(), stats,
+ int ret = driver->load_stats(dpp, y, owner, stats,
last_synced, last_updated);
if (ret < 0 && ret != -ENOENT) {
return ret;
}
}
+ int ret = user->load_user(dpp(), null_yield);
+ if (ret < 0) {
+ cerr << "User has not been initialized or user does not exist" << std::endl;
+ return -ret;
+ }
+
+ const RGWUserInfo& info = user->get_info();
+ rgw_owner owner = info.user_id;
+ if (!info.account_id.empty()) {
+ cerr << "Reading stats for user account " << info.account_id << std::endl;
+ owner = info.account_id;
+ }
+
constexpr bool omit_utilized_stats = false;
RGWStorageStats stats(omit_utilized_stats);
ceph::real_time last_stats_sync;
ceph::real_time last_stats_update;
- int ret = driver->load_stats(dpp(), null_yield, user->get_id(),
- stats, last_stats_sync, last_stats_update);
+ ret = driver->load_stats(dpp(), null_yield, owner, stats,
+ last_stats_sync, last_stats_update);
if (ret < 0) {
if (ret == -ENOENT) { /* in case of ENOENT */
cerr << "User has not been initialized or user does not exist" << std::endl;