mirror of
https://github.com/ceph/ceph
synced 2024-12-26 05:25:09 +00:00
mds/MDSMap: add features to MDSMap's mds_info_t
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
982208135c
commit
4ad8f7254a
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user