From: Yehuda Sadeh Date: Fri, 26 Aug 2016 23:43:23 +0000 (-0700) Subject: rgw_admin: sync status command shows if not syncing from zone X-Git-Tag: v11.1.0~681^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8c030fd92424e7da91226444e87ee1d8fec2aeaf;p=ceph.git rgw_admin: sync status command shows if not syncing from zone Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 60d3e81ea745..2eaf47bfd4ff 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -1795,10 +1795,23 @@ static void get_md_sync_status(list& status) static void get_data_sync_status(const string& source_zone, list& status, int tab) { - RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone); - stringstream ss; + auto ziter = store->zone_by_id.find(source_zone); + if (ziter == store->zone_by_id.end()) { + push_ss(ss, status, tab) << string("zone not found"); + flush_ss(ss, status); + return; + } + RGWZone& sz = ziter->second; + + if (!store->zone_syncs_from(store->get_zone(), sz)) { + push_ss(ss, status, tab) << string("not syncing from zone"); + flush_ss(ss, status); + return; + } + RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone); + int ret = sync.init(); if (ret < 0) { push_ss(ss, status, tab) << string("failed to retrieve sync info: ") + cpp_strerror(-ret);