From: Yehuda Sadeh Date: Thu, 29 Nov 2012 23:30:17 +0000 (-0800) Subject: radosgw-admin: close storage before exit X-Git-Tag: v0.55~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6a69083dcee58bb411f6d81d80055767e1160f27;p=ceph.git radosgw-admin: close storage before exit Fixes: #3560 This will remove watches off notification objects. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 665ac5516e86..0e2b8b323918 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 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()) {