From 482cdca55351ca85290f1b2adb3c0cdf78af411d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 28 Jan 2019 15:05:53 -0600 Subject: [PATCH] osd: record require_osd_release in objectstore meta Record the require_osd_release value from the OSDMap in the 'meta' portion of the osd's metadata that can be accessed without actually mounting the OSD. This will be useful as a safety gate to prevent you from mounting an osd thet is too new that may make incompatible changes to the store. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 13 +++++++++++++ src/osd/OSD.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 0444aab500a..4c6da0e5dd5 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2805,6 +2805,12 @@ int OSD::init() boot_finisher.start(); + { + string val; + store->read_meta("require_osd_release", &val); + last_require_osd_release = atoi(val.c_str()); + } + // mount. dout(2) << "init " << dev_path << " (looks like " << (store_is_rotational ? "hdd" : "ssd") << ")" @@ -8327,6 +8333,13 @@ void OSD::check_osdmap_features() if (osdmap->require_osd_release < CEPH_RELEASE_NAUTILUS) { heartbeat_dispatcher.ms_set_require_authorizer(false); } + + if (osdmap->require_osd_release != last_require_osd_release) { + dout(1) << __func__ << " require_osd_release " << last_require_osd_release + << " -> " << osdmap->require_osd_release << dendl; + store->write_meta("require_osd_release", stringify(osdmap->require_osd_release)); + last_require_osd_release = osdmap->require_osd_release; + } } struct C_FinishSplits : public Context { diff --git a/src/osd/OSD.h b/src/osd/OSD.h index ee5302950f8..e83bcd68eb9 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1298,6 +1298,8 @@ protected: int whoami; std::string dev_path, journal_path; + int last_require_osd_release = 0; + int numa_node = -1; size_t numa_cpu_set_size = 0; cpu_set_t numa_cpu_set; -- 2.39.5