]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
message/MMonMgrReport: conditionally reencode PGMapDigest
authorSage Weil <sage@redhat.com>
Wed, 13 Feb 2019 13:29:45 +0000 (07:29 -0600)
committerSage Weil <sage@redhat.com>
Wed, 13 Feb 2019 20:35:18 +0000 (14:35 -0600)
The encoding changed between luminous and mimic.  Reencode the
structure if the target doesn't have all the features.

Fixes: http://tracker.ceph.com/issues/38295
Signed-off-by: Sage Weil <sage@redhat.com>
src/CMakeLists.txt
src/messages/MMonMgrReport.h
src/mon/CMakeLists.txt

index c677d4100c57fbc9603b731de68c50df3d5a6ce5..3f7123f5451ea44aeb337a6beb008f21edf21767 100644 (file)
@@ -313,6 +313,7 @@ set(libcommon_files
   mon/MonMap.cc
   mon/MonSub.cc
   mgr/MgrClient.cc
+  mon/PGMap.cc
   mgr/ServiceMap.cc
   osd/ECMsgTypes.cc
   osd/HitSet.cc
index ec5ea7aafa6498b8cea05416937f3010355fbee6..818511a37baf80e0aa57655ca9b90bbe5ec6b7b0 100644 (file)
 #include "include/types.h"
 #include "include/health.h"
 #include "mon/health_check.h"
+#include "mon/PGMap.h"
 
-class MMonMgrReport : public MessageInstance<MMonMgrReport, PaxosServiceMessage> {
+class MMonMgrReport
+  : public MessageInstance<MMonMgrReport, PaxosServiceMessage> {
 public:
   friend factory;
 private:
@@ -53,6 +55,23 @@ public:
     encode(health_checks, payload);
     encode(service_map_bl, payload);
     encode(progress_events, payload);
+
+    if (!HAVE_FEATURE(features, SERVER_NAUTILUS) ||
+       !HAVE_FEATURE(features, SERVER_MIMIC)) {
+      // PGMapDigest had a backwards-incompatible change between
+      // luminous and mimic, and conditionally encodes based on
+      // provided features, so reencode the one in our data payload.
+      // The mgr isn't able to do this at the time the encoded
+      // PGMapDigest is constructed because we don't know which mon we
+      // will target.  Note that this only triggers if the user
+      // upgrades ceph-mgr before ceph-mon (tsk tsk).
+      PGMapDigest digest;
+      auto p = data.cbegin();
+      decode(digest, p);
+      bufferlist bl;
+      encode(digest, bl, features);
+      data.swap(bl);
+    }
   }
   void decode_payload() override {
     auto p = payload.cbegin();
index bcfd451de613d5bb92f154a8d1a21aa79efa8154..02b459e214bfaf6f78d232686a803590f54b8eee 100644 (file)
@@ -18,7 +18,6 @@ set(lib_mon_srcs
   ConfigMonitor.cc
   Elector.cc
   HealthMonitor.cc
-  PGMap.cc
   ConfigKeyService.cc
   ../mds/MDSAuthCaps.cc
   ../mgr/mgr_commands.cc