]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Monitor: move time sync status from 'ceph health' to 'time-sync-status' command
authorSage Weil <sage@redhat.com>
Sat, 10 Jun 2017 17:36:40 +0000 (13:36 -0400)
committerSage Weil <sage@redhat.com>
Wed, 12 Jul 2017 16:51:30 +0000 (12:51 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
PendingReleaseNotes
qa/workunits/cephtool/test.sh
src/mon/MonCommands.h
src/mon/Monitor.cc

index b61fb70c2acc612f2e0f7ac6b17b26a327e62ade..03cd6d66dc0251c2ee628fd86c123f694989e147 100644 (file)
   If you deployed Luminous dev releases or 12.1.0 rc release and made use of
   the CRUSH choose_args feature, you need to remove all choose_args mappings
   from your CRUSH map before starting the upgrade.
+
+* The 'ceph health' structured output (JSON or XML) no longer contains
+  a 'timechecks' section describing the time sync status.  This
+  information is now available via the 'ceph time-sync-status'
+  command.
index e17f97efdabe6bfd08de154fb70b54d691e3e340..34c48697c4ba879a513ce2746df69c2b6e07b9bd 100755 (executable)
@@ -706,6 +706,8 @@ function test_mon_misc()
   ceph health --format json-pretty
   ceph health detail --format xml-pretty
 
+  ceph time-sync-status
+
   ceph node ls
   for t in mon osd mds ; do
       ceph node ls $t
index 8d974660f29d05f71f2815708ede355cd50e2814..569c52760a35375207ddb625204e7c271c82b0e2 100644 (file)
@@ -210,6 +210,7 @@ COMMAND_WITH_FLAG("injectargs " \
 COMMAND("status", "show cluster status", "mon", "r", "cli,rest")
 COMMAND("health name=detail,type=CephChoices,strings=detail,req=false", \
        "show cluster health", "mon", "r", "cli,rest")
+COMMAND("time-sync-status", "show time sync status", "mon", "r", "cli,rest")
 COMMAND("df name=detail,type=CephChoices,strings=detail,req=false", \
        "show cluster free space stats", "mon", "r", "cli,rest")
 COMMAND("report name=tags,type=CephString,n=N,req=false", \
index f4593f58499b35b814226bae54d75db1d0bc8cdb..ad2ae3eaca5e943226abf5df0d0d51f0f481e428 100644 (file)
@@ -2464,50 +2464,27 @@ health_status_t Monitor::get_health(list<string>& status,
 
   health_monitor->get_health(f, summary, (detailbl ? &detail : NULL));
 
-  if (f) {
-    f->open_object_section("timechecks");
-    f->dump_unsigned("epoch", get_epoch());
-    f->dump_int("round", timecheck_round);
-    f->dump_stream("round_status")
-      << ((timecheck_round%2) ? "on-going" : "finished");
-  }
-
   health_status_t overall = HEALTH_OK;
   if (!timecheck_skews.empty()) {
     list<string> warns;
-    if (f)
-      f->open_array_section("mons");
     for (map<entity_inst_t,double>::iterator i = timecheck_skews.begin();
          i != timecheck_skews.end(); ++i) {
       entity_inst_t inst = i->first;
       double skew = i->second;
       double latency = timecheck_latencies[inst];
       string name = monmap->get_name(inst.addr);
-
       ostringstream tcss;
       health_status_t tcstatus = timecheck_status(tcss, skew, latency);
       if (tcstatus != HEALTH_OK) {
         if (overall > tcstatus)
           overall = tcstatus;
         warns.push_back(name);
-
         ostringstream tmp_ss;
         tmp_ss << "mon." << name
                << " addr " << inst.addr << " " << tcss.str()
               << " (latency " << latency << "s)";
         detail.push_back(make_pair(tcstatus, tmp_ss.str()));
       }
-
-      if (f) {
-        f->open_object_section("mon");
-        f->dump_string("name", name.c_str());
-        f->dump_float("skew", skew);
-        f->dump_float("latency", latency);
-        f->dump_stream("health") << tcstatus;
-        if (tcstatus != HEALTH_OK)
-          f->dump_stream("details") << tcss.str();
-        f->close_section();
-      }
     }
     if (!warns.empty()) {
       ostringstream ss;
@@ -2521,11 +2498,7 @@ health_status_t Monitor::get_health(list<string>& status,
       status.push_back(ss.str());
       summary.push_back(make_pair(HEALTH_WARN, "Monitor clock skew detected "));
     }
-    if (f)
-      f->close_section();
   }
-  if (f)
-    f->close_section();
 
   if (f)
     f->open_array_section("summary");
@@ -3089,6 +3062,40 @@ void Monitor::handle_command(MonOpRequestRef op)
       rs = "must supply options to be parsed in a single string";
       r = -EINVAL;
     }
+  } else if (prefix == "time-sync-status") {
+    if (!f)
+      f.reset(Formatter::create("json-pretty"));
+    f->open_object_section("time_sync");
+    if (!timecheck_skews.empty()) {
+      f->open_object_section("time_skew_status");
+      for (auto& i : timecheck_skews) {
+       entity_inst_t inst = i.first;
+       double skew = i.second;
+       double latency = timecheck_latencies[inst];
+       string name = monmap->get_name(inst.addr);
+       ostringstream tcss;
+       health_status_t tcstatus = timecheck_status(tcss, skew, latency);
+       f->open_object_section(name.c_str());
+       f->dump_float("skew", skew);
+       f->dump_float("latency", latency);
+       f->dump_stream("health") << tcstatus;
+       if (tcstatus != HEALTH_OK) {
+         f->dump_stream("details") << tcss.str();
+       }
+       f->close_section();
+      }
+      f->close_section();
+    }
+    f->open_object_section("timechecks");
+    f->dump_unsigned("epoch", get_epoch());
+    f->dump_int("round", timecheck_round);
+    f->dump_stream("round_status") << ((timecheck_round%2) ?
+                                      "on-going" : "finished");
+    f->close_section();
+    f->close_section();
+    f->flush(rdata);
+    r = 0;
+    rs = "";
   } else if (prefix == "status" ||
             prefix == "health" ||
             prefix == "df") {