From: John Spray Date: Tue, 29 Apr 2014 14:11:06 +0000 (+0100) Subject: mds: add 'enabled' flag to MDSMap X-Git-Tag: v0.84~164^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8f7900a09c8e490c9cd3a6f92ed1f0eb1f47f2a9;p=ceph.git mds: add 'enabled' flag to MDSMap 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 --- diff --git a/src/mds/MDSMap.cc b/src/mds/MDSMap.cc index e8ca5f1586f5..199e08027100 100644 --- a/src/mds/MDSMap.cc +++ b/src/mds/MDSMap.cc @@ -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; diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h index 7ae67ab60495..9c075682bd40 100644 --- a/src/mds/MDSMap.h +++ b/src/mds/MDSMap.h @@ -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), diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 45c198337797..f233561c9766 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -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);