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

rgw: admin rest api shouldn't return error when getting user's stats if the user hasn't create any bucket. #21551

Merged
merged 1 commit into from
Apr 25, 2018

Conversation

zhangsw
Copy link
Contributor

@zhangsw zhangsw commented Apr 20, 2018

If users haven't create any bucket, get_user_stats will return -ENOENT. And the admin rest api will return NoSuchKey which is confusing.

Signed-off-by: Zhang Shaowen zhangshaowen@cmss.chinamobile.com

the user hasn't create any bucket.

Signed-off-by: Zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
@@ -2348,7 +2348,7 @@ int RGWUserAdminOp_User::info(RGWRados *store, RGWUserAdminOpState& op_state,
RGWStorageStats *arg_stats = NULL;
if (op_state.fetch_stats) {
int ret = store->get_user_stats(info.user_id, stats);
if (ret < 0) {
if (ret < 0 ret != -ENOENT) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&&

@joke-lee
Copy link
Contributor

new create user without create any bucket

< GET /admin/user?info&uid=test2testa&format=json HTTP/1.1
< Host: 127.0.0.1:80
< Accept-Encoding: gzip, deflate
< Accept: */*
< User-Agent: python-requests/2.6.0 CPython/2.7.5 Linux/3.10.0-327.el7.x86_64
< Connection: keep-alive
< date: Fri, 20 Apr 2018 08:15:54 GMT
< Authorization: AWS admin:ejN0kC+NB13+dsg5Y2Xa7KIPk9w=
<

> HTTP/1.1 200 OK
> date: Fri, 20 Apr 2018 08:15:54 GMT
> content-length: 270
> x-amz-request-id: tx00000000000000000002a-005ad9a1ba-121f0-default
> connection: Keep-Alive
>

with get stats

< GET /admin/user?info&uid=test2testa&stats=True&format=json HTTP/1.1
< Host: 127.0.0.1:80
< Accept-Encoding: gzip, deflate
< Accept: */*
< User-Agent: python-requests/2.6.0 CPython/2.7.5 Linux/3.10.0-327.el7.x86_64
< Connection: keep-alive
< date: Fri, 20 Apr 2018 08:16:11 GMT
< Authorization: AWS admin:JMLnVZU8+TGWVI140BPD0+/+NuU=
<

> HTTP/1.1 404 Not Found
> content-length: 116
> accept-ranges: bytes
> connection: Keep-Alive
> x-amz-request-id: tx00000000000000000002c-005ad9a1cb-121f0-default
> date: Fri, 20 Apr 2018 08:16:11 GMT
> content-type: application/json
>
{"Code":"NoSuchKey","RequestId":"tx00000000000000000002c-005ad9a1cb-121f0-default","HostId":"121f0-default-default"}

@cbodley
Copy link
Contributor

cbodley commented Apr 20, 2018

looks good @zhangsw @joke-lee, can you please add a tracker issue so we can backport to luminous?

@cbodley cbodley self-assigned this Apr 20, 2018
@joke-lee
Copy link
Contributor

@cbodley cbodley merged commit df17c66 into ceph:master Apr 25, 2018
@zhangsw zhangsw deleted the fix-rgw-userinfo-stats-bug branch May 24, 2018 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants