diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-03-05 22:00:43 -0800 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-03-22 11:28:02 -0700 |
commit | a6120a60ecd5d0b4ffdee1aa4099264cca5aee17 (patch) | |
tree | d394b6313c31b863937a0f1fd276b1bb39173ab2 | |
parent | 7c220831be75520eeaeb493de1d1cecb21c5f32d (diff) | |
download | ceph-a6120a60ecd5d0b4ffdee1aa4099264cca5aee17.tar.gz |
rgw: user metadata updates also key version
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_admin.cc | 8 | ||||
-rw-r--r-- | src/rgw/rgw_rados.cc | 12 | ||||
-rw-r--r-- | src/rgw/rgw_swift.cc | 2 | ||||
-rw-r--r-- | src/rgw/rgw_tools.cc | 7 | ||||
-rw-r--r-- | src/rgw/rgw_tools.h | 2 | ||||
-rw-r--r-- | src/rgw/rgw_user.cc | 12 | ||||
-rw-r--r-- | src/rgw/rgw_user.h | 2 |
7 files changed, 23 insertions, 22 deletions
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index db76a09a36a..9834c0c851d 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -1477,7 +1477,7 @@ int main(int argc, char **argv) info.subusers[subuser] = u; } - if ((err = rgw_store_user_info(store, info, &old_info, false)) < 0) { + if ((err = rgw_store_user_info(store, info, &old_info, NULL, false)) < 0) { cerr << "error storing user info: " << cpp_strerror(-err) << std::endl; break; } @@ -1503,7 +1503,7 @@ int main(int argc, char **argv) keys_map->erase(kiter); } } - if ((err = rgw_store_user_info(store, info, &old_info, false)) < 0) { + if ((err = rgw_store_user_info(store, info, &old_info, NULL, false)) < 0) { cerr << "error storing user info: " << cpp_strerror(-err) << std::endl; break; } @@ -1529,7 +1529,7 @@ int main(int argc, char **argv) } else { rgw_remove_key_index(store, kiter->second); keys_map->erase(kiter); - if ((err = rgw_store_user_info(store, info, &old_info, false)) < 0) { + if ((err = rgw_store_user_info(store, info, &old_info, NULL, false)) < 0) { cerr << "error storing user info: " << cpp_strerror(-err) << std::endl; break; } @@ -1923,7 +1923,7 @@ next: int ret; info.suspended = disable; - ret = rgw_store_user_info(store, info, &old_info, false); + ret = rgw_store_user_info(store, info, &old_info, NULL, false); if (ret < 0) { cerr << "ERROR: failed to store user info user=" << user_id << " ret=" << ret << std::endl; return 1; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 9d5a649896a..3356823bc80 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -130,7 +130,7 @@ int RGWRegion::set_as_default() ::encode(default_info, bl); - int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), false, NULL); + int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), false, NULL, NULL); if (ret < 0) return ret; @@ -230,7 +230,7 @@ int RGWRegion::store_info(bool exclusive) bufferlist bl; ::encode(*this, bl); - int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), exclusive, NULL); + int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), exclusive, NULL, NULL); return ret; } @@ -309,7 +309,7 @@ int RGWZoneParams::store_info(CephContext *cct, RGWRados *store, RGWRegion& regi bufferlist bl; ::encode(*this, bl); - int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), false, NULL); + int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), false, NULL, NULL); return ret; } @@ -385,7 +385,7 @@ int RGWRegionMap::store(CephContext *cct, RGWRados *store) bufferlist bl; ::encode(*this, bl); - int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), false, NULL); + int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), false, NULL, NULL); return ret; } @@ -1212,7 +1212,7 @@ int RGWRados::store_bucket_info(RGWBucketInfo& info, map<string, bufferlist> *pa bufferlist bl; ::encode(info, bl); - int ret = rgw_put_system_obj(this, zone.domain_root, info.bucket.name, bl.c_str(), bl.length(), exclusive, pattrs); + int ret = rgw_put_system_obj(this, zone.domain_root, info.bucket.name, bl.c_str(), bl.length(), exclusive, NULL, pattrs); if (ret < 0) return ret; @@ -3633,7 +3633,7 @@ int RGWRados::put_bucket_info(string& bucket_name, RGWBucketInfo& info, bool exc ::encode(info, bl); - int ret = rgw_put_system_obj(this, zone.domain_root, bucket_name, bl.c_str(), bl.length(), exclusive, pattrs); + int ret = rgw_put_system_obj(this, zone.domain_root, bucket_name, bl.c_str(), bl.length(), exclusive, NULL, pattrs); return ret; } diff --git a/src/rgw/rgw_swift.cc b/src/rgw/rgw_swift.cc index 59117dc876a..9b9b1bbefb1 100644 --- a/src/rgw/rgw_swift.cc +++ b/src/rgw/rgw_swift.cc @@ -511,7 +511,7 @@ int RGWSwift::update_user_info(RGWRados *store, struct rgw_swift_auth_info *info user_info.user_id = info->user; user_info.display_name = info->display_name; - int ret = rgw_store_user_info(store, user_info, NULL, true); + int ret = rgw_store_user_info(store, user_info, NULL, NULL, true); if (ret < 0) { ldout(cct, 0) << "ERROR: failed to store new user's info: ret=" << ret << dendl; return ret; diff --git a/src/rgw/rgw_tools.cc b/src/rgw/rgw_tools.cc index a8c4fed225b..b36c182c2e4 100644 --- a/src/rgw/rgw_tools.cc +++ b/src/rgw/rgw_tools.cc @@ -14,7 +14,8 @@ static map<string, string> ext_mime_map; -int rgw_put_system_obj(RGWRados *rgwstore, rgw_bucket& bucket, string& oid, const char *data, size_t size, bool exclusive, map<string, bufferlist> *pattrs) +int rgw_put_system_obj(RGWRados *rgwstore, rgw_bucket& bucket, string& oid, const char *data, size_t size, bool exclusive, + obj_version *objv, map<string, bufferlist> *pattrs) { map<string,bufferlist> no_attrs; if (!pattrs) @@ -22,12 +23,12 @@ int rgw_put_system_obj(RGWRados *rgwstore, rgw_bucket& bucket, string& oid, cons rgw_obj obj(bucket, oid); - int ret = rgwstore->put_system_obj(NULL, obj, data, size, exclusive, NULL, *pattrs, NULL); + int ret = rgwstore->put_system_obj(NULL, obj, data, size, exclusive, NULL, *pattrs, objv); if (ret == -ENOENT) { ret = rgwstore->create_pool(bucket); if (ret >= 0) - ret = rgwstore->put_system_obj(NULL, obj, data, size, exclusive, NULL, *pattrs, NULL); + ret = rgwstore->put_system_obj(NULL, obj, data, size, exclusive, NULL, *pattrs, objv); } return ret; diff --git a/src/rgw/rgw_tools.h b/src/rgw/rgw_tools.h index 442c2cc8788..01b5b1bbcd2 100644 --- a/src/rgw/rgw_tools.h +++ b/src/rgw/rgw_tools.h @@ -10,7 +10,7 @@ class RGWRados; struct obj_version; -int rgw_put_system_obj(RGWRados *rgwstore, rgw_bucket& bucket, string& oid, const char *data, size_t size, bool exclusive, map<string, bufferlist> *pattrs = NULL); +int rgw_put_system_obj(RGWRados *rgwstore, rgw_bucket& bucket, string& oid, const char *data, size_t size, bool exclusive, obj_version *objv, map<string, bufferlist> *pattrs = NULL); int rgw_get_system_obj(RGWRados *rgwstore, void *ctx, rgw_bucket& bucket, string& key, bufferlist& bl, obj_version *objv, map<string, bufferlist> *pattrs = NULL); int rgw_tools_init(CephContext *cct); diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc index fe0892a1d7b..d2c972ea6e2 100644 --- a/src/rgw/rgw_user.cc +++ b/src/rgw/rgw_user.cc @@ -36,7 +36,7 @@ bool rgw_user_is_authenticated(RGWUserInfo& info) * Save the given user information to storage. * Returns: 0 on success, -ERR# on failure. */ -int rgw_store_user_info(RGWRados *store, RGWUserInfo& info, RGWUserInfo *old_info, bool exclusive) +int rgw_store_user_info(RGWRados *store, RGWUserInfo& info, RGWUserInfo *old_info, obj_version *objv, bool exclusive) { bufferlist bl; info.encode(bl); @@ -82,14 +82,14 @@ int rgw_store_user_info(RGWRados *store, RGWUserInfo& info, RGWUserInfo *old_inf ::encode(ui, data_bl); ::encode(info, data_bl); - ret = rgw_put_system_obj(store, store->zone.user_uid_pool, info.user_id, data_bl.c_str(), data_bl.length(), exclusive); + ret = rgw_put_system_obj(store, store->zone.user_uid_pool, info.user_id, data_bl.c_str(), data_bl.length(), exclusive, objv); if (ret < 0) return ret; if (info.user_email.size()) { if (!old_info || old_info->user_email.compare(info.user_email) != 0) { /* only if new index changed */ - ret = rgw_put_system_obj(store, store->zone.user_email_pool, info.user_email, link_bl.c_str(), link_bl.length(), exclusive); + ret = rgw_put_system_obj(store, store->zone.user_email_pool, info.user_email, link_bl.c_str(), link_bl.length(), exclusive, objv); if (ret < 0) return ret; } @@ -102,7 +102,7 @@ int rgw_store_user_info(RGWRados *store, RGWUserInfo& info, RGWUserInfo *old_inf if (old_info && old_info->access_keys.count(iter->first) != 0) continue; - ret = rgw_put_system_obj(store, store->zone.user_keys_pool, k.id, link_bl.c_str(), link_bl.length(), exclusive); + ret = rgw_put_system_obj(store, store->zone.user_keys_pool, k.id, link_bl.c_str(), link_bl.length(), exclusive, objv); if (ret < 0) return ret; } @@ -114,7 +114,7 @@ int rgw_store_user_info(RGWRados *store, RGWUserInfo& info, RGWUserInfo *old_inf if (old_info && old_info->swift_keys.count(siter->first) != 0) continue; - ret = rgw_put_system_obj(store, store->zone.user_swift_pool, k.id, link_bl.c_str(), link_bl.length(), exclusive); + ret = rgw_put_system_obj(store, store->zone.user_swift_pool, k.id, link_bl.c_str(), link_bl.length(), exclusive, objv); if (ret < 0) return ret; } @@ -521,7 +521,7 @@ public: return ret; - ret = rgw_store_user_info(store, info, &old_info, false); + ret = rgw_store_user_info(store, info, &old_info, &objv, false); if (ret < 0) return ret; diff --git a/src/rgw/rgw_user.h b/src/rgw/rgw_user.h index e70f9535731..f4e0122e275 100644 --- a/src/rgw/rgw_user.h +++ b/src/rgw/rgw_user.h @@ -40,7 +40,7 @@ extern bool rgw_user_is_authenticated(RGWUserInfo& info); * Save the given user information to storage. * Returns: 0 on success, -ERR# on failure. */ -extern int rgw_store_user_info(RGWRados *store, RGWUserInfo& info, RGWUserInfo *old_info, bool exclusive); +extern int rgw_store_user_info(RGWRados *store, RGWUserInfo& info, RGWUserInfo *old_info, obj_version *objv, bool exclusive); /** * Given an email, finds the user info associated with it. * returns: 0 on success, -ERR# on failure (including nonexistence) |