]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/MDSMap: add features to MDSMap's mds_info_t
authorSage Weil <sage@redhat.com>
Tue, 10 Nov 2015 21:45:32 +0000 (16:45 -0500)
committerSage Weil <sage@redhat.com>
Tue, 1 Mar 2016 16:16:59 +0000 (11:16 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mds/MDSMap.cc
src/mds/MDSMap.h

index 73c2df98bc0420b4887e3fa972d815c04ed98d83..e93f7a3e0bc786beadd77c5e211ab153707939cb 100644 (file)
@@ -85,6 +85,7 @@ void MDSMap::mds_info_t::dump(Formatter *f) const
        p != export_targets.end(); ++p) {
     f->dump_int("mds", *p);
   }
+  f->dump_unsigned("features", mds_features);
   f->close_section();
 }
 
@@ -398,7 +399,7 @@ void MDSMap::get_health(list<pair<health_status_t,string> >& summary,
 
 void MDSMap::mds_info_t::encode_versioned(bufferlist& bl, uint64_t features) const
 {
-  ENCODE_START(4, 4, bl);
+  ENCODE_START(5, 4, bl);
   ::encode(global_id, bl);
   ::encode(name, bl);
   ::encode(rank, bl);
@@ -410,6 +411,7 @@ void MDSMap::mds_info_t::encode_versioned(bufferlist& bl, uint64_t features) con
   ::encode(standby_for_rank, bl);
   ::encode(standby_for_name, bl);
   ::encode(export_targets, bl);
+  ::encode(mds_features, bl);
   ENCODE_FINISH(bl);
 }
 
@@ -432,7 +434,7 @@ void MDSMap::mds_info_t::encode_unversioned(bufferlist& bl) const
 
 void MDSMap::mds_info_t::decode(bufferlist::iterator& bl)
 {
-  DECODE_START_LEGACY_COMPAT_LEN(4, 4, 4, bl);
+  DECODE_START_LEGACY_COMPAT_LEN(5, 4, 4, bl);
   ::decode(global_id, bl);
   ::decode(name, bl);
   ::decode(rank, bl);
@@ -445,6 +447,8 @@ void MDSMap::mds_info_t::decode(bufferlist::iterator& bl)
   ::decode(standby_for_name, bl);
   if (struct_v >= 2)
     ::decode(export_targets, bl);
+  if (struct_v >= 5)
+    ::decode(mds_features, bl);
   DECODE_FINISH(bl);
 }
 
index 16249b0cd9c37800e7ee4dc134af547489ff6553..4503aac95c0736bef47228a97ed2f0fded1b4adb 100644 (file)
@@ -140,6 +140,7 @@ public:
     mds_rank_t standby_for_rank;
     std::string standby_for_name;
     std::set<mds_rank_t> export_targets;
+    uint64_t mds_features;
 
     mds_info_t() : global_id(MDS_GID_NONE), rank(MDS_RANK_NONE), inc(0), state(STATE_STANDBY), state_seq(0),
                   standby_for_rank(MDS_NO_STANDBY_PREF) { }
@@ -350,6 +351,19 @@ public:
     s = failed;
   }
 
+  // features
+  uint64_t get_up_features() {
+    uint64_t f = 0;
+    for (std::map<mds_rank_t, mds_gid_t>::const_iterator p = up.begin();
+        p != up.end();
+        ++p) {
+      std::map<mds_gid_t, mds_info_t>::const_iterator q = mds_info.find(p->second);
+      assert(q != mds_info.end());
+      f |= q->second.mds_features;
+    }
+    return f;
+  }
+
   /**
    * Get MDS ranks which are in but not up.
    */