From: Casey Bodley Date: Fri, 4 Dec 2015 22:07:22 +0000 (-0500) Subject: rgw: RGWRealm::set_current_period takes RGWPeriod X-Git-Tag: v10.1.0~354^2~81 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=423719bab79ad087e6e01c32c2d26bf7c479247c;p=ceph.git rgw: RGWRealm::set_current_period takes RGWPeriod set_current_period() doesn't need to set the predecessor; RGWPeriod::commit() takes care of that Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 775eb2d55ca..3f1d0f5311f 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -716,7 +716,7 @@ int RGWRealm::create(bool exclusive) return ret; } } - ret = set_current_period(period.get_id()); + ret = set_current_period(period); if (ret < 0) { return ret; } @@ -783,28 +783,18 @@ const string& RGWRealm::get_info_oid_prefix(bool old_format) return realm_info_oid_prefix; } -int RGWRealm::set_current_period(const string& period_id) { - /* check to see period id is valid */ - RGWPeriod new_current(period_id); - int ret = new_current.init(cct, store, id, name); - if (ret < 0) { - ldout(cct, 0) << "Error init new period id " << period_id << " : " << cpp_strerror(-ret) << dendl; - return ret; - } - new_current.set_predecessor(current_period); +int RGWRealm::set_current_period(RGWPeriod& period) +{ - ret = new_current.store_info(false); - if (ret < 0) { - return ret; - } - current_period = period_id; - ret = update(); + current_period = period.get_id(); + + int ret = update(); if (ret < 0) { ldout(cct, 0) << "ERROR: period update: " << cpp_strerror(-ret) << dendl; return ret; } - ret = new_current.reflect(); + ret = period.reflect(); if (ret < 0) { ldout(cct, 0) << "ERROR: period.reflect(): " << cpp_strerror(-ret) << dendl; return ret; @@ -1299,7 +1289,7 @@ int RGWPeriod::commit(RGWRealm& realm, const RGWPeriod& current_period) return r; } // set as current period - r = realm.set_current_period(id); + r = realm.set_current_period(*this); if (r < 0) { lderr(cct) << "failed to update realm's current period: " << cpp_strerror(-r) << dendl; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 8f199b737b3..6413c7f825c 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1324,7 +1324,7 @@ public: const string& get_current_period() const { return current_period; } - int set_current_period(const string& period_id); + int set_current_period(RGWPeriod& period); string get_control_oid(); /// send a notify on the realm control object diff --git a/src/rgw/rgw_rest_realm.cc b/src/rgw/rgw_rest_realm.cc index d97671e83ca..8db20bd90b7 100644 --- a/src/rgw/rgw_rest_realm.cc +++ b/src/rgw/rgw_rest_realm.cc @@ -140,7 +140,7 @@ void RGWOp_Period_Post::execute() return; } // set as current period - http_ret = realm.set_current_period(period.get_id()); // TODO: add sync status argument + http_ret = realm.set_current_period(period); if (http_ret < 0) { lderr(cct) << "failed to update realm's current period" << dendl; return;