diff options
author | Yan, Zheng <zyan@redhat.com> | 2016-04-06 15:08:00 +0200 |
---|---|---|
committer | Yan, Zheng <zyan@redhat.com> | 2016-06-10 03:30:19 +0200 |
commit | 049debf74f7b25d19e1519b7bf99817630cd1e84 (patch) | |
tree | 1cb7c47f263587d4ce97dbe124512f7d73824e54 /src/mon | |
parent | messages: add MFSMapUser (diff) | |
download | ceph-049debf74f7b25d19e1519b7bf99817630cd1e84.tar.xz ceph-049debf74f7b25d19e1519b7bf99817630cd1e84.zip |
MDSMonitor: handle fsmap.user subscription
return FSMap data that are visiable to normal users.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'src/mon')
-rw-r--r-- | src/mon/MDSMonitor.cc | 23 | ||||
-rw-r--r-- | src/mon/Monitor.cc | 2 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 53cdec0d08e..ec6f5e37d75 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -26,6 +26,7 @@ #include "common/cmdparse.h" #include "messages/MMDSMap.h" #include "messages/MFSMap.h" +#include "messages/MFSMapUser.h" #include "messages/MMDSLoadTargets.h" #include "messages/MMonCommand.h" #include "messages/MGenericMessage.h" @@ -2453,6 +2454,7 @@ void MDSMonitor::check_subs() // filesystems. Build a list of all the types we service // subscriptions for. types.push_back("fsmap"); + types.push_back("fsmap.user"); types.push_back("mdsmap"); for (const auto &i : fsmap.filesystems) { auto fscid = i.first; @@ -2487,7 +2489,26 @@ void MDSMonitor::check_sub(Subscription *sub) sub->next = fsmap.get_epoch() + 1; } } - } else { + } else if (sub->type == "fsmap.user") { + if (sub->next <= fsmap.get_epoch()) { + FSMapUser fsmap_u; + fsmap_u.epoch = fsmap.get_epoch(); + fsmap_u.legacy_client_fscid = fsmap.legacy_client_fscid; + for (auto p = fsmap.filesystems.begin(); + p != fsmap.filesystems.end(); + ++p) { + FSMapUser::fs_info_t& fs_info = fsmap_u.filesystems[p->first]; + fs_info.cid = p->first; + fs_info.name= p->second->mds_map.fs_name; + } + sub->session->con->send_message(new MFSMapUser(mon->monmap->fsid, fsmap_u)); + if (sub->onetime) { + mon->session_map.remove_sub(sub); + } else { + sub->next = fsmap.get_epoch() + 1; + } + } + } else if (sub->type.compare(0, 6, "mdsmap") == 0) { if (sub->next > fsmap.get_epoch()) { return; } diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 5014f4afc67..10c8bfc1dc0 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -4271,7 +4271,7 @@ void Monitor::handle_subscribe(MonOpRequestRef op) p->second.flags & CEPH_SUBSCRIBE_ONETIME, m->get_connection()->has_feature(CEPH_FEATURE_INCSUBOSDMAP)); - if (p->first.find("mdsmap") == 0 || p->first == "fsmap") { + if (p->first.compare(0, 6, "mdsmap") == 0 || p->first.compare(0, 5, "fsmap") == 0) { dout(10) << __func__ << ": MDS sub '" << p->first << "'" << dendl; if ((int)s->is_capable("mds", MON_CAP_R)) { Subscription *sub = s->sub_map[p->first]; |