From bd815bd9d6ecdecaab3d2dd9e0f5a18aa795d749 Mon Sep 17 00:00:00 2001 From: Sridhar Seshasayee Date: Mon, 22 Nov 2021 20:46:02 +0530 Subject: [PATCH] osd/OSDMap: Add health warning if 'require-osd-release' != current release After all OSDs are upgraded to a new release, generate a health warning if the 'require-osd-release' flag doesn't match the the new release version. This will result in the cluster showing a warning in the health state until the flag is set properly. Fixes: https://tracker.ceph.com/issues/51984 Signed-off-by: Sridhar Seshasayee --- src/osd/OSDMap.cc | 30 +++++++++++++++++++++++++++++- src/osd/OSDMap.h | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index f0096d32bee..1168b6dc356 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -5993,7 +5993,13 @@ void OSDMap::check_health(CephContext *cct, } // OSD_UPGRADE_FINISHED - // none of these (yet) since we don't run until luminous upgrade is done. + if (auto require_release = pending_require_osd_release()) { + ostringstream ss; + ss << "all OSDs are running " << *require_release << " or later but" + << " require_osd_release < " << *require_release; + auto& d = checks->add("OSD_UPGRADE_FINISHED", HEALTH_WARN, ss.str(), 0); + d.detail.push_back(ss.str()); + } // POOL_NEARFULL/BACKFILLFULL/FULL { @@ -6226,3 +6232,25 @@ unsigned OSDMap::get_device_class_flags(int id) const flags = it->second; return flags; } + +std::optional OSDMap::pending_require_osd_release() const +{ + if (HAVE_FEATURE(get_up_osd_features(), SERVER_QUINCY) && + require_osd_release < ceph_release_t::quincy) { + return "quincy"; + } + if (HAVE_FEATURE(get_up_osd_features(), SERVER_PACIFIC) && + require_osd_release < ceph_release_t::pacific) { + return "pacific"; + } + if (HAVE_FEATURE(get_up_osd_features(), SERVER_OCTOPUS) && + require_osd_release < ceph_release_t::octopus) { + return "octopus"; + } + if (HAVE_FEATURE(get_up_osd_features(), SERVER_NAUTILUS) && + require_osd_release < ceph_release_t::nautilus) { + return "nautilus"; + } + + return std::nullopt; +} diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 711badddec0..cfd93a10db1 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -1542,6 +1542,7 @@ public: std::ostream *ss) const; float pool_raw_used_rate(int64_t poolid) const; + std::optional pending_require_osd_release() const; }; WRITE_CLASS_ENCODER_FEATURES(OSDMap) -- 2.39.5