From: Yehuda Sadeh Date: Thu, 17 Oct 2019 19:55:22 +0000 (-0700) Subject: rgw-admin: sync group get command X-Git-Tag: v15.1.0~22^2~98 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e163cd05653557f4cd91d4a25412fe0177fee09f;p=ceph.git rgw-admin: sync group get command Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 1717fbfd84f4..c7b71d94267a 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -650,6 +650,7 @@ enum class OPT { SYNC_ERROR_LIST, SYNC_ERROR_TRIM, SYNC_GROUP_CREATE, + SYNC_GROUP_GET, SYNC_GROUP_REMOVE, SYNC_GROUP_FLOW_ADD, SYNC_GROUP_FLOW_REMOVE, @@ -849,6 +850,7 @@ static SimpleCmd::Commands all_cmds = { { "sync error trim", OPT::SYNC_ERROR_TRIM }, { "sync policy get", OPT::SYNC_POLICY_GET }, { "sync group create", OPT::SYNC_GROUP_CREATE }, + { "sync group get", OPT::SYNC_GROUP_GET }, { "sync group remove", OPT::SYNC_GROUP_REMOVE }, { "sync group flow add", OPT::SYNC_GROUP_FLOW_ADD }, { "sync group flow remove", OPT::SYNC_GROUP_FLOW_REMOVE }, @@ -3375,6 +3377,7 @@ int main(int argc, const char **argv) OPT::MDLOG_LIST, OPT::MDLOG_STATUS, OPT::SYNC_ERROR_LIST, + OPT::SYNC_GROUP_GET, OPT::SYNC_POLICY_GET, OPT::BILOG_LIST, OPT::BILOG_STATUS, @@ -7662,6 +7665,29 @@ next: formatter->flush(cout); } + if (opt_cmd == OPT::SYNC_GROUP_GET) { + RGWZoneGroup zonegroup(zonegroup_id, zonegroup_name); + ret = zonegroup.init(g_ceph_context, store->svc()->sysobj); + if (ret < 0) { + cerr << "failed to init zonegroup: " << cpp_strerror(-ret) << std::endl; + return -ret; + } + + auto& groups = zonegroup.sync_policy.groups; + + if (!opt_group_id) { + show_result(groups, formatter, cout); + } else { + auto iter = zonegroup.sync_policy.groups.find(*opt_group_id); + if (iter == zonegroup.sync_policy.groups.end()) { + cerr << "ERROR: could not find group '" << *opt_group_id << "'" << std::endl; + return ENOENT; + } + + show_result(iter->second, formatter, cout); + } + } + if (opt_cmd == OPT::SYNC_GROUP_REMOVE) { CHECK_TRUE(require_opt(opt_group_id, "ERROR: --group-id not specified"), EINVAL);