From: Sage Weil Date: Mon, 28 Jan 2019 21:05:53 +0000 (-0600) Subject: osd: record require_osd_release in objectstore meta X-Git-Tag: v13.2.7~140^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=49f37f311577c034dac0d2a09b5ce6a169d556b3;p=ceph.git 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 (cherry picked from commit 482cdca55351ca85290f1b2adb3c0cdf78af411d) Conflicts: src/osd/OSD.cc src/osd/OSD.h - ignore differences in surrounding context, as they do not seem relevant to the fix --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 2a2cee1121dc..acea552bfe33 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2385,6 +2385,12 @@ int OSD::init() service.recovery_request_timer.init(); service.sleep_timer.init(); + { + 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") << ")" @@ -7772,6 +7778,13 @@ void OSD::check_osdmap_features() assert(err == 0); } } + + 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 1739c84e55f5..ec242cecd405 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1261,6 +1261,8 @@ protected: int whoami; std::string dev_path, journal_path; + int last_require_osd_release = 0; + bool store_is_rotational = true; bool journal_is_rotational = true;