]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: record require_osd_release in objectstore meta
authorSage Weil <sage@redhat.com>
Mon, 28 Jan 2019 21:05:53 +0000 (15:05 -0600)
committerNathan Cutler <ncutler@suse.com>
Mon, 9 Dec 2019 22:09:57 +0000 (23:09 +0100)
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 <sage@redhat.com>
(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

src/osd/OSD.cc
src/osd/OSD.h

index e61ee9571c69f3e0b38424a64cbe6cb11df07800..776a63fb37738a46231df77152655bb8af39b8a9 100644 (file)
@@ -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(
index c8731b8f9d7073ec0c84e1805dae933489a76712..2f7e3c7c8cbda59f896aec1c62b92ef011e06587 100644 (file)
@@ -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;