]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MgrMap: include mgr_features in mgrmap
authorSage Weil <sage@redhat.com>
Wed, 4 Sep 2019 19:08:14 +0000 (14:08 -0500)
committerSage Weil <sage@redhat.com>
Fri, 6 Sep 2019 02:29:56 +0000 (21:29 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/messages/MMgrBeacon.h
src/mgr/MgrStandby.cc
src/mon/MgrMap.h
src/mon/MgrMonitor.cc

index bf93b54ab0e0e564d4a29fa52353163c2a57bab4..6b09fec9c9177a147b7bad4a31ef041c4b9d1c28 100644 (file)
@@ -24,7 +24,7 @@
 
 class MMgrBeacon : public PaxosServiceMessage {
 private:
-  static constexpr int HEAD_VERSION = 8;
+  static constexpr int HEAD_VERSION = 9;
   static constexpr int COMPAT_VERSION = 8;
 
 protected:
@@ -45,6 +45,8 @@ protected:
 
   map<string,string> metadata; ///< misc metadata about this osd
 
+  uint64_t mgr_features = 0;   ///< reporting mgr's features
+
 public:
   MMgrBeacon()
     : PaxosServiceMessage{MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION},
@@ -54,10 +56,12 @@ public:
   MMgrBeacon(const uuid_d& fsid_, uint64_t gid_, const std::string &name_,
              entity_addrvec_t server_addrs_, bool available_,
             std::vector<MgrMap::ModuleInfo>&& modules_,
-            map<string,string>&& metadata_)
+            map<string,string>&& metadata_,
+            uint64_t feat)
     : PaxosServiceMessage{MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION},
       gid(gid_), server_addrs(server_addrs_), available(available_), name(name_),
-      fsid(fsid_), modules(std::move(modules_)), metadata(std::move(metadata_))
+      fsid(fsid_), modules(std::move(modules_)), metadata(std::move(metadata_)),
+      mgr_features(feat)
   {
   }
 
@@ -69,10 +73,10 @@ public:
   const std::map<std::string,std::string>& get_metadata() const {
     return metadata;
   }
-
   const std::map<std::string,std::string>& get_services() const {
     return services;
   }
+  uint64_t get_mgr_features() const { return mgr_features; }
 
   void set_services(const std::map<std::string, std::string> &svcs)
   {
@@ -138,6 +142,7 @@ public:
     encode(services, payload);
 
     encode(modules, payload);
+    encode(mgr_features, payload);
   }
   void decode_payload() override {
     auto p = payload.cbegin();
@@ -174,6 +179,9 @@ public:
     if (header.version >= 7) {
       decode(modules, p);
     }
+    if (header.version >= 9) {
+      decode(mgr_features, p);
+    }
   }
 private:
   template<class T, typename... Args>
index 527dc042a7436a02257d3bc545cfd265f85e2bf0..35bbbfb46166f13512d275533a62544f616f6aba 100644 (file)
@@ -224,7 +224,8 @@ void MgrStandby::send_beacon()
                                  addrs,
                                  available,
                                 std::move(module_info),
-                                std::move(metadata));
+                                std::move(metadata),
+                                CEPH_FEATURES_ALL);
 
   if (available) {
     if (!available_in_map) {
index c30c8811ed7a5921f7493319c2a27cc91ed7d051..c3db247355618b7d66f3a64daeecf411d6cc56f1 100644 (file)
@@ -156,22 +156,23 @@ public:
   class StandbyInfo
   {
   public:
-    uint64_t gid;
+    uint64_t gid = 0;
     std::string name;
     std::vector<ModuleInfo> available_modules;
+    uint64_t mgr_features = 0;
 
     StandbyInfo(uint64_t gid_, const std::string &name_,
-                const std::vector<ModuleInfo>& am)
-      : gid(gid_), name(name_), available_modules(am)
+                const std::vector<ModuleInfo>& am,
+               uint64_t feat)
+      : gid(gid_), name(name_), available_modules(am),
+       mgr_features(feat)
     {}
 
-    StandbyInfo()
-      : gid(0)
-    {}
+    StandbyInfo() {}
 
     void encode(ceph::buffer::list& bl) const
     {
-      ENCODE_START(3, 1, bl);
+      ENCODE_START(4, 1, bl);
       encode(gid, bl);
       encode(name, bl);
       std::set<std::string> old_available_modules;
@@ -180,12 +181,13 @@ public:
       }
       encode(old_available_modules, bl);  // version 2
       encode(available_modules, bl);  // version 3
+      encode(mgr_features, bl); // v4
       ENCODE_FINISH(bl);
     }
 
     void decode(ceph::buffer::list::const_iterator& p)
     {
-      DECODE_START(3, p);
+      DECODE_START(4, p);
       decode(gid, p);
       decode(name, p);
       if (struct_v >= 2) {
@@ -202,6 +204,9 @@ public:
       if (struct_v >= 3) {
         decode(available_modules, p);
       }
+      if (struct_v >= 4) {
+       decode(mgr_features, p);
+      }
       DECODE_FINISH(p);
     }
 
@@ -229,6 +234,8 @@ public:
   std::string active_name;
   /// when the active mgr became active, or we lost the active mgr
   utime_t active_change;
+  /// features
+  uint64_t active_mgr_features = 0;
 
   std::map<uint64_t, StandbyInfo> standbys;
 
@@ -372,7 +379,7 @@ public:
       ENCODE_FINISH(bl);
       return;
     }
-    ENCODE_START(8, 6, bl);
+    ENCODE_START(9, 6, bl);
     encode(epoch, bl);
     encode(active_addrs, bl, features);
     encode(active_gid, bl);
@@ -384,13 +391,14 @@ public:
     encode(available_modules, bl);
     encode(active_change, bl);
     encode(always_on_modules, bl);
+    encode(active_mgr_features, bl);
     ENCODE_FINISH(bl);
     return;
   }
 
   void decode(ceph::buffer::list::const_iterator& p)
   {
-    DECODE_START(7, p);
+    DECODE_START(8, p);
     decode(epoch, p);
     decode(active_addrs, p);
     decode(active_gid, p);
@@ -429,6 +437,9 @@ public:
     if (struct_v >= 8) {
       decode(always_on_modules, p);
     }
+    if (struct_v >= 9) {
+      decode(active_mgr_features, p);
+    }
     DECODE_FINISH(p);
   }
 
@@ -439,6 +450,7 @@ public:
     f->dump_object("active_addrs", active_addrs);
     f->dump_stream("active_addr") << active_addrs.get_legacy_str();
     f->dump_stream("active_change") << active_change;
+    f->dump_unsigned("active_mgr_features", active_mgr_features);
     f->dump_bool("available", available);
     f->open_array_section("standbys");
     for (const auto &i : standbys) {
@@ -449,6 +461,7 @@ public:
       for (const auto& j : i.second.available_modules) {
         j.dump(f);
       }
+      f->dump_unsigned("mgr_features", i.second.mgr_features);
       f->close_section();
       f->close_section();
     }
index eabae5a11c515d6777e9841af49b131a9ffddad5..d3172c302f5f41459e5662ad9ddc850678705b61 100644 (file)
@@ -530,6 +530,7 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op)
     pending_map.active_gid = m->get_gid();
     pending_map.active_name = m->get_name();
     pending_map.active_change = ceph_clock_now();
+    pending_map.active_mgr_features = m->get_mgr_features();
     pending_map.available_modules = m->get_available_modules();
     encode(m->get_metadata(), pending_metadata[m->get_name()]);
     pending_metadata_rm.erase(m->get_name());
@@ -556,7 +557,8 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op)
       mon->clog->debug() << "Standby manager daemon " << m->get_name()
                          << " started";
       pending_map.standbys[m->get_gid()] = {m->get_gid(), m->get_name(),
-                                           m->get_available_modules()};
+                                           m->get_available_modules(),
+                                           m->get_mgr_features()};
       encode(m->get_metadata(), pending_metadata[m->get_name()]);
       pending_metadata_rm.erase(m->get_name());
       updated = true;
@@ -797,6 +799,8 @@ bool MgrMonitor::promote_standby()
     auto replacement_gid = pending_map.standbys.begin()->first;
     pending_map.active_gid = replacement_gid;
     pending_map.active_name = pending_map.standbys.at(replacement_gid).name;
+    pending_map.active_mgr_features =
+      pending_map.standbys.at(replacement_gid).mgr_features;
     pending_map.available = false;
     pending_map.active_addrs = entity_addrvec_t();
     pending_map.active_change = ceph_clock_now();
@@ -820,6 +824,7 @@ void MgrMonitor::drop_active()
   pending_map.active_name = "";
   pending_map.active_gid = 0;
   pending_map.active_change = ceph_clock_now();
+  pending_map.active_mgr_features = 0;
   pending_map.available = false;
   pending_map.active_addrs = entity_addrvec_t();
   pending_map.services.clear();