From: Sage Weil Date: Sat, 10 Jun 2017 17:36:40 +0000 (-0400) Subject: mon/Monitor: move time sync status from 'ceph health' to 'time-sync-status' command X-Git-Tag: v12.1.1~58^2~43 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6068e1856d5ba953698708cdc9cf3ed4eee2b027;p=ceph-ci.git mon/Monitor: move time sync status from 'ceph health' to 'time-sync-status' command Signed-off-by: Sage Weil --- diff --git a/PendingReleaseNotes b/PendingReleaseNotes index b61fb70c2ac..03cd6d66dc0 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -194,3 +194,8 @@ 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. diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index e17f97efdab..34c48697c4b 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -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 diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 8d974660f29..569c52760a3 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -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", \ diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index f4593f58499..ad2ae3eaca5 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2464,50 +2464,27 @@ health_status_t Monitor::get_health(list& 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 warns; - if (f) - f->open_array_section("mons"); for (map::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& 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") {