]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw-admin: close storage before exit
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 29 Nov 2012 23:30:17 +0000 (15:30 -0800)
committerSage Weil <sage@inktank.com>
Thu, 29 Nov 2012 23:33:22 +0000 (15:33 -0800)
Fixes: #3560
This will remove watches off notification objects.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_admin.cc

index 665ac5516e86107f710093a9d56d261d73e99386..0e2b8b32391830a0d139076d2f18c8b6d87c4c36 100644 (file)
@@ -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()) {