]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon: add MMonHealth back
authorKefu Chai <kchai@redhat.com>
Thu, 22 Feb 2018 05:56:46 +0000 (13:56 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 22 Feb 2018 10:43:22 +0000 (18:43 +0800)
This partially reverts commit 7b4a741fbda4dc817a003c694e96c8df7c1d2092.

we need to at least decode MMonHealth sent from luminous monitors in
mimic. and in luminous, we could drop the support of this message, if we
can only upgrade from mimic.

Fixes: http://tracker.ceph.com/issues/22462
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/messages/MMonHealth.h [new file with mode: 0644]
src/mon/Monitor.cc
src/msg/Message.cc
src/msg/Message.h

diff --git a/src/messages/MMonHealth.h b/src/messages/MMonHealth.h
new file mode 100644 (file)
index 0000000..31550b2
--- /dev/null
@@ -0,0 +1,63 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2012 Inktank, Inc.
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation.  See file COPYING.
+ *
+ */
+#ifndef CEPH_MMON_HEALTH_H
+#define CEPH_MMON_HEALTH_H
+
+#include "msg/Message.h"
+#include "messages/MMonQuorumService.h"
+#include "mon/mon_types.h"
+
+struct MMonHealth : public MMonQuorumService
+{
+  static const int HEAD_VERSION = 1;
+
+  int service_type = 0;
+  int service_op = 0;
+
+  // service specific data
+  DataStats data_stats;
+
+  MMonHealth() : MMonQuorumService(MSG_MON_HEALTH, HEAD_VERSION) { }
+
+private:
+  ~MMonHealth() override { }
+
+public:
+  const char *get_type_name() const override { return "mon_health"; }
+  void print(ostream &o) const override {
+    o << "mon_health("
+      << " e " << get_epoch()
+      << " r " << get_round()
+      << " )";
+  }
+
+  void decode_payload() override {
+    bufferlist::iterator p = payload.begin();
+    service_decode(p);
+    decode(service_type, p);
+    decode(service_op, p);
+    decode(data_stats, p);
+  }
+
+  void encode_payload(uint64_t features) override {
+    using ceph::encode;
+    service_encode();
+    encode(service_type, payload);
+    encode(service_op, payload);
+    encode(data_stats, payload);
+  }
+
+};
+
+#endif /* CEPH_MMON_HEALTH_H */
index 4a93abbe6f6b97ddafb1e559a6e74921e7a56893..8aca1d5cb1df336e1053db87cc357ee8b684db4c 100644 (file)
@@ -4233,6 +4233,10 @@ void Monitor::dispatch_op(MonOpRequestRef op)
       handle_timecheck(op);
       break;
 
+    case MSG_MON_HEALTH:
+      dout(5) << __func__ << " dropping deprecated message: "
+             << *op->get_req() << dendl;
+      break;
     case MSG_MON_HEALTH_CHECKS:
       op->set_type_service();
       paxos_service[PAXOS_HEALTH]->dispatch(op);
index 11ad14ae28c74dbb1c78abd382bfbbaa54e4959f..4a4fe794a3a87a34232b76fe34eb39ad48820fb2 100644 (file)
@@ -95,6 +95,7 @@
 #include "messages/MMonGetMap.h"
 #include "messages/MMonGetVersion.h"
 #include "messages/MMonGetVersionReply.h"
+#include "messages/MMonHealth.h"
 #include "messages/MMonHealthChecks.h"
 #include "messages/MMonMetadata.h"
 #include "messages/MDataPing.h"
@@ -783,6 +784,10 @@ Message *decode_message(CephContext *cct, int crcflags,
     m = new MTimeCheck();
     break;
 
+  case MSG_MON_HEALTH:
+    m = new MMonHealth();
+    break;
+
   case MSG_MON_HEALTH_CHECKS:
     m = new MMonHealthChecks();
     break;
index b19991d1cecb790f73a510f17a2fdd722d0b30ca..091b07d6ee2179483d9c732a853194aa64da20e5 100644 (file)
 
 // *** generic ***
 #define MSG_TIMECHECK             0x600
-//#define MSG_MON_HEALTH            0x601  // remove post-luminous
+#define MSG_MON_HEALTH            0x601
 
 // *** Message::encode() crcflags bits ***
 #define MSG_CRC_DATA           (1 << 0)