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: fix bucket limit check argparse, div(0) #15316

Merged
merged 1 commit into from May 26, 2017

Conversation

Projects
None yet
2 participants
@mattbenjamin
Contributor

mattbenjamin commented May 26, 2017

  1. normalize arg parsing for "bucket limit check"
    1.1 s/buckets/bucket/

  2. avoid dividing by num_shards when it is 0

Signed-off-by: Matt Benjamin mbenjamin@redhat.com

@mattbenjamin mattbenjamin self-assigned this May 26, 2017

@mattbenjamin mattbenjamin requested review from cbodley and yehudasa May 26, 2017

@@ -1470,7 +1470,8 @@ int RGWBucketAdminOp::limit_check(RGWRados *store,
}
num_shards = info.num_shards;
uint64_t objs_per_shard = num_objects / num_shards;
uint64_t objs_per_shard = (num_shards) ?
num_objects/num_shards : std::max(uint64_t(0), num_objects);

This comment has been minimized.

@cbodley

cbodley May 26, 2017

Contributor

num_objects is unsigned, so max(0, num_objects) is a noop. looks good otherwise

This comment has been minimized.

@mattbenjamin

mattbenjamin May 26, 2017

Contributor

ok, yeah, it's just num_objects; as noted, on downstream, I see info.num_shareds == 0 when there is no sharding

rgw-admin: fix bucket limit check argparse, div(0)
1. normalize arg parsing for "bucket limit check"
1.1 s/buckets/bucket/

2. avoid dividing by num_shards when it is 0

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>

@cbodley cbodley merged commit 4c45d84 into ceph:master May 26, 2017

3 checks passed

Signed-off-by all commits in this PR are signed
Details
Unmodifed Submodules submodules for project are unmodified
Details
default Build finished.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment