Skip to content

Commit

Permalink
Merge pull request ceph#13276 from rzarzynski/wip-rgw-18364-2-jewel
Browse files Browse the repository at this point in the history
jewel: rgw: be aware abount tenants on cls_user_bucket -> rgw_bucket conversion

Reviewed-by: Casey Bodley <cbodley@redhat.com>
  • Loading branch information
Loic Dachary committed Feb 16, 2017
2 parents 87f8341 + 260801f commit 5cda572
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
5 changes: 2 additions & 3 deletions src/rgw/rgw_bucket.cc
Expand Up @@ -134,9 +134,8 @@ int rgw_read_user_buckets(RGWRados * store,
if (ret < 0)
return ret;

for (list<cls_user_bucket_entry>::iterator q = entries.begin(); q != entries.end(); ++q) {
RGWBucketEnt e(*q);
buckets.add(e);
for (const auto& entry : entries) {
buckets.add(RGWBucketEnt(user_id, entry));
total++;
}

Expand Down
2 changes: 1 addition & 1 deletion src/rgw/rgw_bucket.h
Expand Up @@ -126,7 +126,7 @@ class RGWUserBuckets
/**
* Add a (created) bucket to the user's bucket list.
*/
void add(RGWBucketEnt& bucket) {
void add(const RGWBucketEnt& bucket) {
buckets[bucket.bucket.name] = bucket;
}

Expand Down
25 changes: 16 additions & 9 deletions src/rgw/rgw_common.h
Expand Up @@ -693,10 +693,15 @@ struct rgw_bucket {

rgw_bucket() { }
// cppcheck-suppress noExplicitConstructor
rgw_bucket(const cls_user_bucket& b) : name(b.name), data_pool(b.data_pool),
data_extra_pool(b.data_extra_pool),
index_pool(b.index_pool), marker(b.marker),
bucket_id(b.bucket_id) {}
explicit rgw_bucket(const rgw_user& u, const cls_user_bucket& b)
: tenant(u.tenant),
name(b.name),
data_pool(b.data_pool),
data_extra_pool(b.data_extra_pool),
index_pool(b.index_pool),
marker(b.marker),
bucket_id(b.bucket_id) {
}
rgw_bucket(const string& s) : name(s) {
data_pool = index_pool = s;
marker = "";
Expand Down Expand Up @@ -1352,11 +1357,13 @@ struct RGWBucketEnt {

RGWBucketEnt() : size(0), size_rounded(0), count(0) {}

explicit RGWBucketEnt(const cls_user_bucket_entry& e) : bucket(e.bucket),
size(e.size),
size_rounded(e.size_rounded),
creation_time(e.creation_time),
count(e.count) {}
explicit RGWBucketEnt(const rgw_user& u, const cls_user_bucket_entry& e)
: bucket(u, e.bucket),
size(e.size),
size_rounded(e.size_rounded),
creation_time(e.creation_time),
count(e.count) {
}

void convert(cls_user_bucket_entry *b) {
bucket.convert(&b->bucket);
Expand Down

0 comments on commit 5cda572

Please sign in to comment.