From e4ae368ff7a5396194f8bdd5692429af5457998b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 13 Feb 2019 07:29:45 -0600 Subject: [PATCH] message/MMonMgrReport: conditionally reencode PGMapDigest 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 --- src/CMakeLists.txt | 1 + src/messages/MMonMgrReport.h | 21 ++++++++++++++++++++- src/mon/CMakeLists.txt | 1 - 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c677d4100c57f..3f7123f5451ea 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/messages/MMonMgrReport.h b/src/messages/MMonMgrReport.h index ec5ea7aafa649..818511a37baf8 100644 --- a/src/messages/MMonMgrReport.h +++ b/src/messages/MMonMgrReport.h @@ -19,8 +19,10 @@ #include "include/types.h" #include "include/health.h" #include "mon/health_check.h" +#include "mon/PGMap.h" -class MMonMgrReport : public MessageInstance { +class MMonMgrReport + : public MessageInstance { 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(); diff --git a/src/mon/CMakeLists.txt b/src/mon/CMakeLists.txt index bcfd451de613d..02b459e214bfa 100644 --- a/src/mon/CMakeLists.txt +++ b/src/mon/CMakeLists.txt @@ -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 -- 2.39.5