summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2012-11-29 15:30:17 -0800
committerSage Weil <sage@inktank.com>2012-11-29 15:33:22 -0800
commit6a69083dcee58bb411f6d81d80055767e1160f27 (patch)
tree67a4f68950befd9c0517f2294141acabdd867c21
parent7d27e2e95c8cb1bb3f5950ff224e49bfd353db9c (diff)
downloadceph-6a69083dcee58bb411f6d81d80055767e1160f27.tar.gz
radosgw-admin: close storage before exit
Fixes: #3560 This will remove watches off notification objects. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r--src/rgw/rgw_admin.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc
index 665ac5516e8..0e2b8b32391 100644
--- a/src/rgw/rgw_admin.cc
+++ b/src/rgw/rgw_admin.cc
@@ -29,7 +29,7 @@ using namespace std;
#define SECRET_KEY_LEN 40
#define PUBLIC_ID_LEN 20
-RGWRados *store;
+static RGWRados *store = NULL;
void _usage()
{
@@ -648,6 +648,15 @@ static int remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_childr
return ret;
}
+class StoreDestructor {
+ RGWRados *store;
+public:
+ StoreDestructor(RGWRados *_s) : store(_s) {}
+ ~StoreDestructor() {
+ RGWStoreManager::close_storage(store);
+ }
+};
+
int main(int argc, char **argv)
{
vector<const char*> args;
@@ -861,6 +870,8 @@ int main(int argc, char **argv)
return 5; //EIO
}
+ StoreDestructor store_destructor(store);
+
if (opt_cmd != OPT_USER_CREATE &&
opt_cmd != OPT_LOG_SHOW && opt_cmd != OPT_LOG_LIST && opt_cmd != OPT_LOG_RM &&
user_id.empty()) {