]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "pacific: mgr, mon: Keep upto date metadata with mgr for MONs" 46920/head
authorPrashant D <pdvian@users.noreply.github.com>
Fri, 1 Jul 2022 05:18:24 +0000 (15:18 +1000)
committerPrashant D <pdhange@redhat.com>
Wed, 6 Jul 2022 05:19:14 +0000 (06:19 +0100)
This reverts pacific commit 98760e36c7bbbb48657e4d033bcbb080a56bbf7b

Reason: The service_daemon is related to client daemons like rgw,
iscsi demons and it should not be handled in MMgrUpdate.

More details in https://tracker.ceph.com/issues/55322

Signed-off-by: Prashant D <pdhange@redhat.com>
src/messages/MMgrUpdate.h [deleted file]
src/mgr/DaemonServer.cc
src/mgr/DaemonServer.h
src/mgr/MgrClient.cc
src/mgr/MgrClient.h
src/mon/Monitor.cc
src/mon/Monitor.h
src/mon/MonmapMonitor.cc
src/msg/Message.cc
src/msg/Message.h
src/msg/MessageRef.h

diff --git a/src/messages/MMgrUpdate.h b/src/messages/MMgrUpdate.h
deleted file mode 100644 (file)
index 71a528d..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-// -*- 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) 2022 Prashant D <pdhange@redhat.com>
- *
- * 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_MMGRUPDATE_H_
-#define CEPH_MMGRUPDATE_H_
-
-#include "msg/Message.h"
-
-class MMgrUpdate : public Message {
-private:
-  static constexpr int HEAD_VERSION = 3;
-  static constexpr int COMPAT_VERSION = 1;
-
-public:
-
-  std::string daemon_name;
-  std::string service_name;  // optional; otherwise infer from entity type
-
-  bool service_daemon = false;
-  std::map<std::string,std::string> daemon_metadata;
-  std::map<std::string,std::string> daemon_status;
-
-  bool need_metadata_update = false;
-
-  void decode_payload() override
-  {
-    using ceph::decode;
-    auto p = payload.cbegin();
-    decode(daemon_name, p);
-    if (header.version >= 2) {
-      decode(service_name, p);
-      decode(service_daemon, p);
-      if (service_daemon) {
-       decode(daemon_metadata, p);
-       decode(daemon_status, p);
-      }
-    }
-    if (header.version >= 3) {
-      decode(need_metadata_update, p);
-    }
-  }
-
-  void encode_payload(uint64_t features) override {
-    using ceph::encode;
-    encode(daemon_name, payload);
-    encode(service_name, payload);
-    encode(service_daemon, payload);
-    if (service_daemon) {
-      encode(daemon_metadata, payload);
-      encode(daemon_status, payload);
-    }
-    encode(need_metadata_update, payload);
-  }
-
-  std::string_view get_type_name() const override { return "mgrupdate"; }
-  void print(std::ostream& out) const override {
-    out << get_type_name() << "(";
-    if (service_name.length()) {
-      out << service_name;
-    } else {
-      out << ceph_entity_type_name(get_source().type());
-    }
-    out << "." << daemon_name;
-    if (service_daemon) {
-      out << " daemon";
-    }
-    out << ")";
-  }
-
-private:
-  MMgrUpdate()
-    : Message{MSG_MGR_UPDATE, HEAD_VERSION, COMPAT_VERSION}
-  {}
-  using RefCountedObject::put;
-  using RefCountedObject::get;
-  template<class T, typename... Args>
-  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
-};
-
-#endif
-
index 4753fcb66f018b890f90aab0f054a7cfb9635234..509a540ec320fbcca9b29f56e77183ea7a67b0f4 100644 (file)
@@ -27,7 +27,6 @@
 #include "mon/MonCommand.h"
 
 #include "messages/MMgrOpen.h"
-#include "messages/MMgrUpdate.h"
 #include "messages/MMgrClose.h"
 #include "messages/MMgrConfigure.h"
 #include "messages/MMonMgrReport.h"
@@ -259,8 +258,6 @@ bool DaemonServer::ms_dispatch2(const ref_t<Message>& m)
       return handle_report(ref_cast<MMgrReport>(m));
     case MSG_MGR_OPEN:
       return handle_open(ref_cast<MMgrOpen>(m));
-    case MSG_MGR_UPDATE:
-      return handle_update(ref_cast<MMgrUpdate>(m));
     case MSG_MGR_CLOSE:
       return handle_close(ref_cast<MMgrClose>(m));
     case MSG_COMMAND:
@@ -525,49 +522,6 @@ bool DaemonServer::handle_open(const ref_t<MMgrOpen>& m)
   return true;
 }
 
-bool DaemonServer::handle_update(const ref_t<MMgrUpdate>& m)
-{
-  DaemonKey key;
-  if (!m->service_name.empty()) {
-    key.type = m->service_name;
-  } else {
-    key.type = ceph_entity_type_name(m->get_connection()->get_peer_type());
-  }
-  key.name = m->daemon_name;
-
-  dout(10) << "from " << m->get_connection() << " " << key << dendl;
-
-  if (m->get_connection()->get_peer_type() == entity_name_t::TYPE_CLIENT &&
-      m->service_name.empty()) {
-    // Clients should not be sending us update request
-    dout(10) << "rejecting update request from non-daemon client " << m->daemon_name
-            << dendl;
-    clog->warn() << "rejecting report from non-daemon client " << m->daemon_name
-                << " at " << m->get_connection()->get_peer_addrs();
-    m->get_connection()->mark_down();
-    return true;
-  }
-
-
-  {
-    std::unique_lock locker(lock);
-
-    DaemonStatePtr daemon;
-    // Look up the DaemonState
-    if (daemon_state.exists(key)) {
-      dout(20) << "updating existing DaemonState for " << key << dendl;
-
-      daemon = daemon_state.get(key);
-      if (m->need_metadata_update == true &&
-          !m->daemon_metadata.empty()) {
-        daemon_state.update_metadata(daemon, m->daemon_metadata);
-      }
-    }
-  }
-
-  return true;
-}
-
 bool DaemonServer::handle_close(const ref_t<MMgrClose>& m)
 {
   std::lock_guard l(lock);
index a4cf990bd319bbca78de8d38bf7455629827e292..334992d829ea1ec612c6ff25b8a0014588658e80 100644 (file)
@@ -36,7 +36,6 @@
 
 class MMgrReport;
 class MMgrOpen;
-class MMgrUpdate;
 class MMgrClose;
 class MMonMgrReport;
 class MCommand;
@@ -276,7 +275,6 @@ public:
 
   void fetch_missing_metadata(const DaemonKey& key, const entity_addr_t& addr);
   bool handle_open(const ceph::ref_t<MMgrOpen>& m);
-  bool handle_update(const ceph::ref_t<MMgrUpdate>& m);
   bool handle_close(const ceph::ref_t<MMgrClose>& m);
   bool handle_report(const ceph::ref_t<MMgrReport>& m);
   bool handle_command(const ceph::ref_t<MCommand>& m);
index 626c9941a09dab00bb5d0155b5584c2f72492c5d..4ac88dd99d4627073c46137026071f7910e7edc8 100644 (file)
@@ -21,7 +21,6 @@
 #include "messages/MMgrMap.h"
 #include "messages/MMgrReport.h"
 #include "messages/MMgrOpen.h"
-#include "messages/MMgrUpdate.h"
 #include "messages/MMgrClose.h"
 #include "messages/MMgrConfigure.h"
 #include "messages/MCommand.h"
@@ -246,25 +245,6 @@ void MgrClient::_send_open()
   }
 }
 
-void MgrClient::_send_update()
-{
-  if (session && session->con) {
-    auto update = make_message<MMgrUpdate>();
-    if (!service_name.empty()) {
-      update->service_name = service_name;
-      update->daemon_name = daemon_name;
-    } else {
-      update->daemon_name = cct->_conf->name.get_id();
-    }
-    if (service_daemon) {
-      update->service_daemon = service_daemon;
-      update->daemon_metadata = daemon_metadata;
-    }
-    update->need_metadata_update = need_metadata_update;
-    session->con->send_message2(update);
-  }
-}
-
 bool MgrClient::handle_mgr_map(ref_t<MMgrMap> m)
 {
   ceph_assert(ceph_mutex_is_locked_by_me(lock));
@@ -588,31 +568,6 @@ bool MgrClient::handle_command_reply(
   return true;
 }
 
-int MgrClient::update_daemon_metadata(
-  const std::string& service,
-  const std::string& name,
-  const std::map<std::string,std::string>& metadata)
-{
-  std::lock_guard l(lock);
-  if (service_daemon) {
-    return -EEXIST;
-  }
-  ldout(cct,1) << service << "." << name << " metadata " << metadata << dendl;
-  service_daemon = true;
-  service_name = service;
-  daemon_name = name;
-  daemon_metadata = metadata;
-  daemon_dirty_status = true;
-
-  if (need_metadata_update == true &&
-      !daemon_metadata.empty()) {
-    _send_update();
-    need_metadata_update = false;
-  }
-
-  return 0;
-}
-
 int MgrClient::service_daemon_register(
   const std::string& service,
   const std::string& name,
index 1668d8da0fbc29fc64894e21b0fa5aefc58ca27b..6bd2b26e11a37c4cc272585807fe9f7b34e0c62c 100644 (file)
@@ -94,7 +94,6 @@ protected:
   bool service_daemon = false;
   bool daemon_dirty_status = false;
   bool task_dirty_status = false;
-  bool need_metadata_update = true;
   std::string service_name, daemon_name;
   std::map<std::string,std::string> daemon_metadata;
   std::map<std::string,std::string> daemon_status;
@@ -103,7 +102,6 @@ protected:
 
   void reconnect();
   void _send_open();
-  void _send_update();
 
   // In pre-luminous clusters, the ceph-mgr service is absent or optional,
   // so we must not block in start_command waiting for it.
@@ -159,10 +157,6 @@ public:
     ceph::buffer::list *outbl, std::string *outs,
     Context *onfinish);
 
-  int update_daemon_metadata(
-    const std::string& service,
-    const std::string& name,
-    const std::map<std::string,std::string>& metadata);
   int service_daemon_register(
     const std::string& service,
     const std::string& name,
index e5f304d10b2133b29345dc16887629ab3009baa6..e60a5f3b03faa0c401c607effc87d1494e86d3f2 100644 (file)
@@ -2966,19 +2966,6 @@ void Monitor::log_health(
   }
 }
 
-void Monitor::update_pending_metadata()
-{
-  Metadata metadata;
-  collect_metadata(&metadata);
-  size_t version_size = mon_metadata[rank]["ceph_version_short"].size();
-  const std::string current_version = mon_metadata[rank]["ceph_version_short"];
-  const std::string pending_version = metadata["ceph_version_short"];
-
-  if (current_version.compare(0, version_size, pending_version) < 0) {
-    mgr_client.update_daemon_metadata("mon", name, metadata);
-  }
-}
-
 void Monitor::get_cluster_status(stringstream &ss, Formatter *f,
                                 MonSession *session)
 {
index 1f7e64e8592cbbd8e4cff8a2a06fe253b4305723..e16dc4a323a32770a6417372e3d7d7ab1b9892f3 100644 (file)
@@ -796,8 +796,6 @@ public:
     const health_check_map_t& previous,
     MonitorDBStore::TransactionRef t);
 
-  void update_pending_metadata();
-
 protected:
 
   class HealthCheckLogStatus {
index 1ecbea8578c27222bfb0cb8e32665fb247de4ea2..c9dfa3af499b15bf49eca86d0dd74f89a93e6e6f 100644 (file)
@@ -248,8 +248,6 @@ void MonmapMonitor::on_active()
 
   apply_mon_features(mon.get_quorum_mon_features(),
                     mon.quorum_min_mon_release);
-
-  mon.update_pending_metadata();
 }
 
 bool MonmapMonitor::preprocess_query(MonOpRequestRef op)
index 266eb7676786b85ea7481855fa6d8bd94c600a56..6c57d355bdf49f95f90a2f624a3a705290c2cd6d 100644 (file)
 #include "messages/MMgrDigest.h"
 #include "messages/MMgrReport.h"
 #include "messages/MMgrOpen.h"
-#include "messages/MMgrUpdate.h"
 #include "messages/MMgrClose.h"
 #include "messages/MMgrConfigure.h"
 #include "messages/MMonMgrReport.h"
@@ -894,10 +893,6 @@ Message *decode_message(CephContext *cct,
     m = make_message<MMgrOpen>();
     break;
 
-  case MSG_MGR_UPDATE:
-    m = make_message<MMgrUpdate>();
-    break;
-
   case MSG_MGR_CLOSE:
     m = make_message<MMgrClose>();
     break;
index c3b47eee20b07b67be80b5c0d8f23586d5c9e87b..8e1c4f967f05942855a6f34e9f1135a8470eb190 100644 (file)
 #define MSG_MGR_COMMAND           0x709
 #define MSG_MGR_COMMAND_REPLY     0x70a
 
-// *** ceph-mgr <-> MON daemons ***
-#define MSG_MGR_UPDATE     0x70b
-
 // ======================================================
 
 // abstract Message class
index 6bed38311c1480b466fed38af3029b9cba8836a1..2c11aced52b34f559503726120f1aec6cee1f5ee 100644 (file)
@@ -97,7 +97,6 @@ class MMgrConfigure;
 class MMgrDigest;
 class MMgrMap;
 class MMgrOpen;
-class MMgrUpdate;
 class MMgrReport;
 class MMonCommandAck;
 class MMonCommand;