From 6ba8db68cd1cc8f6fdecda83266f2525f1a8dcd0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 8 Jan 2019 21:53:45 -0600 Subject: [PATCH] mon/HealthMonitor: raise MON_MSGR2_NOT_ENABLED if mons not bound to msgr2 If the ms_bind_msgr2 option is enabled, and all mons are nautilus, raise a health alert if any mons aren't bound to msgr2 addresses. Whitelist tests that mon_bind_addrvec=false or mon_bind_msgr2=false. Signed-off-by: Sage Weil --- doc/rados/operations/health-checks.rst | 20 ++++++++++++++++++ qa/suites/rados/thrash-old-clients/ceph.yaml | 2 ++ .../luminous-x-singleton/0-cluster/start.yaml | 2 ++ src/mon/HealthMonitor.cc | 21 +++++++++++++++++++ src/msg/msg_types.h | 8 +++++++ 5 files changed, 53 insertions(+) diff --git a/doc/rados/operations/health-checks.rst b/doc/rados/operations/health-checks.rst index d93fc6d296559..06a52aedaacc2 100644 --- a/doc/rados/operations/health-checks.rst +++ b/doc/rados/operations/health-checks.rst @@ -52,6 +52,26 @@ If it is impractical to keep the clocks closely synchronized, the value must stay significantly below the ``mon_lease`` interval in order for monitor cluster to function properly. +MON_MSGR2_NOT_ENABLED +_____________________ + +The ``ms_bind_msgr2`` option is enabled but one or more monitors is +not configured to bind to a v2 port in the cluster's monmap. This +means that features specific to the msgr2 protocol (e.g., encryption) +are not available on some or all connections. + +In most cases this can be corrected by issuing the command:: + + ceph mon enable-msgr2 + +That command will change any monitor configured for the old default +port 6789 to continue to listen for v1 connections on 6789 and also +listen for v2 connections on the new default 3300 port. + +If a monitor is configured to listen for v1 connections on a non-standard port (not 6789), then the monmap will need to be modified manually. + + + Manager ------- diff --git a/qa/suites/rados/thrash-old-clients/ceph.yaml b/qa/suites/rados/thrash-old-clients/ceph.yaml index 1b9c856800553..b0c28783375bb 100644 --- a/qa/suites/rados/thrash-old-clients/ceph.yaml +++ b/qa/suites/rados/thrash-old-clients/ceph.yaml @@ -1,3 +1,5 @@ tasks: - ceph: mon_bind_addrvec: false + log-whitelist: + - \(MON_MSGR2_NOT_ENABLED\) diff --git a/qa/suites/rados/upgrade/luminous-x-singleton/0-cluster/start.yaml b/qa/suites/rados/upgrade/luminous-x-singleton/0-cluster/start.yaml index c67ec972d9195..308e1c60b23e9 100644 --- a/qa/suites/rados/upgrade/luminous-x-singleton/0-cluster/start.yaml +++ b/qa/suites/rados/upgrade/luminous-x-singleton/0-cluster/start.yaml @@ -7,6 +7,8 @@ overrides: ceph: mon_bind_addrvec: false mon_bind_msgr2: false + log-whitelist: + - \(MON_MSGR2_NOT_ENABLED\) fs: xfs conf: global: diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index e255b16e2f109..845942514745a 100644 --- a/src/mon/HealthMonitor.cc +++ b/src/mon/HealthMonitor.cc @@ -366,6 +366,27 @@ bool HealthMonitor::check_leader_health() } } + // MON_MSGR2_NOT_ENABLED + if (g_conf().get_val("ms_bind_msgr2") && + mon->monmap->get_required_features().contains_all( + ceph::features::mon::FEATURE_NAUTILUS)) { + list details; + for (auto& i : mon->monmap->mon_info) { + if (!i.second.public_addrs.has_msgr2()) { + ostringstream ds; + ds << "mon." << i.first << " is not bound to a msgr2 port, only " + << i.second.public_addrs; + details.push_back(ds.str()); + } + } + if (!details.empty()) { + ostringstream ss; + ss << details.size() << " monitors have not enabled msgr2"; + auto& d = next.add("MON_MSGR2_NOT_ENABLED", HEALTH_WARN, ss.str()); + d.detail.swap(details); + } + } + if (next != leader_checks) { changed = true; leader_checks = next; diff --git a/src/msg/msg_types.h b/src/msg/msg_types.h index 1049ad540a0c1..8ae0bd52806b6 100644 --- a/src/msg/msg_types.h +++ b/src/msg/msg_types.h @@ -598,6 +598,14 @@ struct entity_addrvec_t { } return entity_addr_t(); } + bool has_msgr2() const { + for (auto& a : v) { + if (a.is_msgr2()) { + return true; + } + } + return false; + } bool parse(const char *s, const char **end = 0); -- 2.39.5