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: v12.2.13~17^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6fcccd7b620e1ffcf237622f6b99ca73a68c59b0;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 e61ee9571c69f..776a63fb37738 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2582,6 +2582,12 @@ int OSD::init() service.recovery_request_timer.init(); service.recovery_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") << ")" @@ -8738,6 +8744,13 @@ void OSD::check_osdmap_features(ObjectStore *fs) 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; + } } bool OSD::advance_pg( diff --git a/src/osd/OSD.h b/src/osd/OSD.h index c8731b8f9d707..2f7e3c7c8cbda 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1247,6 +1247,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;