]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_admin: sync status command shows if not syncing from zone
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 26 Aug 2016 23:43:23 +0000 (16:43 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 7 Oct 2016 17:31:28 +0000 (10:31 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_admin.cc

index 60d3e81ea745998bf1adf7e0998114866720bb17..2eaf47bfd4ffa5213c41ccd7cd71e1fd629e7425 100644 (file)
@@ -1795,10 +1795,23 @@ static void get_md_sync_status(list<string>& status)
 
 static void get_data_sync_status(const string& source_zone, list<string>& 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);