From: Casey Bodley Date: Wed, 3 Feb 2016 15:00:30 +0000 (-0500) Subject: rgw-admin: update callers of get_log X-Git-Tag: v10.1.0~354^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=02edcdd905d28708e25324dcf2ea189cc452cb88;p=ceph.git rgw-admin: update callers of get_log Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 9c2857b9b7df..cb4730b1a777 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -4393,9 +4393,22 @@ next: int i = (specified_shard_id ? shard_id : 0); + if (period_id.empty()) { + // read current_period from the realm + RGWRealm realm(realm_id, realm_name); + ret = realm.init(g_ceph_context, store); + if (ret < 0) { + std::cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl; + return -ret; + } + period_id = realm.get_current_period(); + std::cerr << "No --period given, using current period=" + << period_id << std::endl; + } + RGWMetadataLog *meta_log = store->meta_mgr->get_log(period_id); + formatter->open_array_section("entries"); for (; i < g_ceph_context->_conf->rgw_md_log_max_shards; i++) { - RGWMetadataLog *meta_log = store->meta_mgr->get_log(); void *handle; list entries; @@ -4431,11 +4444,23 @@ next: if (opt_cmd == OPT_MDLOG_STATUS) { int i = (specified_shard_id ? shard_id : 0); - RGWMetadataLog *meta_log = store->meta_mgr->get_log(); + if (period_id.empty()) { + // read current_period from the realm + RGWRealm realm(realm_id, realm_name); + int ret = realm.init(g_ceph_context, store); + if (ret < 0) { + std::cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl; + return ret; + } + period_id = realm.get_current_period(); + std::cerr << "No --period given, using current period=" + << period_id << std::endl; + } + RGWMetadataLog *meta_log = store->meta_mgr->get_log(period_id); + formatter->open_array_section("entries"); - for (; i < g_ceph_context->_conf->rgw_md_log_max_shards; i++) { - list entries; + for (; i < g_ceph_context->_conf->rgw_md_log_max_shards; i++) { RGWMetadataLogInfo info; meta_log->get_info(i, &info); @@ -4466,7 +4491,11 @@ next: if (ret < 0) return -ret; - RGWMetadataLog *meta_log = store->meta_mgr->get_log(); + if (period_id.empty()) { + std::cerr << "missing --period argument" << std::endl; + return EINVAL; + } + RGWMetadataLog *meta_log = store->meta_mgr->get_log(period_id); ret = meta_log->trim(shard_id, start_time, end_time, start_marker, end_marker); if (ret < 0) {