]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
message/MMonMgrReport: conditionally reencode PGMapDigest
authorSage Weil <sage@redhat.com>
Wed, 13 Feb 2019 13:29:45 +0000 (07:29 -0600)
committerNathan Cutler <ncutler@suse.com>
Tue, 26 Feb 2019 12:52:47 +0000 (13:52 +0100)
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>
(cherry picked from commit e4ae368ff7a5396194f8bdd5692429af5457998b)

Conflicts:
src/CMakeLists.txt
        src/messages/MMonMgrReport.h
- mimic has msgr V1
- do not check SERVER_NAUTILUS on mimic
- use begin() instead of cbegin() on mimic

src/CMakeLists.txt
src/messages/MMonMgrReport.h
src/mon/CMakeLists.txt

index b56a5f745e615e895bcd46e53460bd145adb2fad..772da92f29ee1353c33093cead7c00f83033db50 100644 (file)
@@ -468,6 +468,7 @@ set(libcommon_files
   mon/MonClient.cc
   mon/MonMap.cc
   mgr/MgrClient.cc
+  mon/PGMap.cc
   msg/simple/Accepter.cc
   msg/DispatchQueue.cc
   msg/Message.cc
index 72bbfe0a72aba6b292e2c28a7665c506a5f9c918..99893e27de611d7563ab3a1cec2c98be1cb02ab6 100644 (file)
@@ -19,6 +19,7 @@
 #include "include/types.h"
 #include "include/health.h"
 #include "mon/health_check.h"
+#include "mon/PGMap.h"
 
 class MMonMgrReport : public PaxosServiceMessage {
 
@@ -48,6 +49,22 @@ public:
     paxos_encode();
     encode(health_checks, payload);
     encode(service_map_bl, payload);
+
+    if (!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.begin();
+      decode(digest, p);
+      bufferlist bl;
+      encode(digest, bl, features);
+      data.swap(bl);
+    }
   }
   void decode_payload() override {
     bufferlist::iterator p = payload.begin();
index c8e2edbd7116b7fc755bf4e2f94ac5b10a4ad2c9..3f89769863ae0cf13f5c136660737f53a6a60d18 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