]> git-server-git.apps.pok.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>
Wed, 24 Jul 2019 09:01:27 +0000 (11:01 +0200)
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 2a2cee1121dca3703cccb8f461dde0290aa1d3a7..acea552bfe33ee6cbcbdd338e095457453052d43 100644 (file)
@@ -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 {
index 1739c84e55f5fbf16424815f6054881e466a01ee..ec242cecd405128ae56432902810c093c800504b 100644 (file)
@@ -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;