]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add 'enabled' flag to MDSMap
authorJohn Spray <john.spray@inktank.com>
Tue, 29 Apr 2014 14:11:06 +0000 (15:11 +0100)
committerJohn Spray <jspray@redhat.com>
Mon, 30 Jun 2014 09:30:42 +0000 (10:30 +0100)
When 'enabled' is false, the MDSMap is effectively
null.  This allows Ceph clusters with no filesystem
or filesystem data/metadata pools.

Signed-off-by: John Spray <john.spray@inktank.com>
src/mds/MDSMap.cc
src/mds/MDSMap.h
src/mon/MDSMonitor.cc

index e8ca5f1586f58ed691dc56eda6e87d5af2e93020..199e080271007baead710e6efe64845934583f64 100644 (file)
@@ -476,7 +476,7 @@ void MDSMap::encode(bufferlist& bl, uint64_t features) const
     ::encode(stopped, bl);
     ::encode(last_failure_osd_epoch, bl);
   } else {// have MDS encoding feature!
-    ENCODE_START(4, 4, bl);
+    ENCODE_START(5, 5, bl);
     ::encode(epoch, bl);
     ::encode(flags, bl);
     ::encode(last_failure, bl);
@@ -488,6 +488,7 @@ void MDSMap::encode(bufferlist& bl, uint64_t features) const
     ::encode(mds_info, bl, features);
     ::encode(data_pools, bl);
     ::encode(cas_pool, bl);
+    ::encode(enabled, bl);
 
     // kclient ignores everything from here
     __u16 ev = 7;
@@ -512,7 +513,7 @@ void MDSMap::encode(bufferlist& bl, uint64_t features) const
 
 void MDSMap::decode(bufferlist::iterator& p)
 {
-  DECODE_START_LEGACY_COMPAT_LEN_16(4, 4, 4, p);
+  DECODE_START_LEGACY_COMPAT_LEN_16(5, 4, 4, p);
   ::decode(epoch, p);
   ::decode(flags, p);
   ::decode(last_failure, p);
@@ -537,6 +538,9 @@ void MDSMap::decode(bufferlist::iterator& p)
     ::decode(data_pools, p);
     ::decode(cas_pool, p);
   }
+  if (struct_v >= 5) {
+    ::decode(enabled, p);
+  }
 
   // kclient ignores everything from here
   __u16 ev = 1;
index 7ae67ab60495dbfecf2cb0f0749af2052268901d..9c075682bd40c1bf24d650a1754149f30d402511 100644 (file)
@@ -144,6 +144,7 @@ public:
 protected:
   // base map
   epoch_t epoch;
+  bool enabled;
   uint32_t flags;        // flags
   epoch_t last_failure;  // mds epoch of last failure
   epoch_t last_failure_osd_epoch; // osd epoch of last failure; any mds entering replay needs
@@ -191,7 +192,7 @@ public:
 
 public:
   MDSMap() 
-    : epoch(0), flags(0), last_failure(0), last_failure_osd_epoch(0), tableserver(0), root(0),
+    : epoch(0), enabled(false), flags(0), last_failure(0), last_failure_osd_epoch(0), tableserver(0), root(0),
       session_timeout(0),
       session_autoclose(0),
       max_file_size(0),
index 45c198337797c670008e13a945a1db6a1f722265..f233561c976696ec58bac6e969b7b17b3b0c4871 100644 (file)
@@ -59,6 +59,7 @@ void MDSMonitor::print_map(MDSMap &m, int dbl)
 
 void MDSMonitor::create_new_fs(MDSMap &m, int metadata_pool, int data_pool)
 {
+  m.enabled = true;
   m.max_mds = g_conf->max_mds;
   m.created = ceph_clock_now(g_ceph_context);
   m.data_pools.insert(data_pool);