From c160ec990aa341c2a7ef4438ad4a336ed41e1175 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 20 Aug 2019 10:05:09 +0800 Subject: [PATCH] mon/HealthMonitor: remove unused label move the whole sanity checks into `HealthMonitor::preprocess_command()`. this change silences warning of: warning: label 'reply' defined but not used [-Wunused-label] Signed-off-by: Kefu Chai --- src/mon/HealthMonitor.cc | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index dac93bb9438b..c6029b415d35 100644 --- a/src/mon/HealthMonitor.cc +++ b/src/mon/HealthMonitor.cc @@ -170,17 +170,9 @@ bool HealthMonitor::preprocess_query(MonOpRequestRef op) PaxosServiceMessage *m = static_cast(op->get_req()); switch (m->get_type()) { case MSG_MON_COMMAND: - try { - return preprocess_command(op); - } catch (const bad_cmd_get& e) { - bufferlist bl; - mon->reply_command(op, -EINVAL, e.what(), bl, get_last_committed()); - return true; - } - + return preprocess_command(op); case MSG_MON_HEALTH_CHECKS: return false; - default: mon->no_reply(op); derr << "Unhandled message type " << m->get_type() << dendl; @@ -222,25 +214,17 @@ bool HealthMonitor::preprocess_command(MonOpRequestRef op) get_last_committed()); return true; } - - string format; - cmd_getval(g_ceph_context, cmdmap, "format", format); - boost::scoped_ptr f(Formatter::create(format, "json-pretty", - "json-pretty")); - - string prefix; - cmd_getval(g_ceph_context, cmdmap, "prefix", prefix); - int r = 0; - -//} else { - return false; -//} - -reply: - string rs; - getline(ss, rs); - mon->reply_command(op, r, rs, rdata, get_last_committed()); - return true; + // more sanity checks + try { + string format; + cmd_getval(g_ceph_context, cmdmap, "format", format); + string prefix; + cmd_getval(g_ceph_context, cmdmap, "prefix", prefix); + } catch (const bad_cmd_get& e) { + mon->reply_command(op, -EINVAL, e.what(), rdata, get_last_committed()); + return true; + } + return false; } bool HealthMonitor::prepare_command(MonOpRequestRef op) -- 2.47.3