MCPcopy Create free account
hub / github.com/ceph/ceph / preprocess_alive

Method preprocess_alive

src/mon/OSDMonitor.cc:3916–3954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3914// alive
3915
3916bool OSDMonitor::preprocess_alive(MonOpRequestRef op)
3917{
3918 op->mark_osdmon_event(__func__);
3919 auto m = op->get_req<MOSDAlive>();
3920 int from = m->get_orig_source().num();
3921
3922 // check permissions, ignore if failed
3923 MonSession *session = op->get_session();
3924 if (!session)
3925 goto ignore;
3926 if (!session->is_capable("osd", MON_CAP_X)) {
3927 dout(0) << "attempt to send MOSDAlive from entity with insufficient privileges:"
3928 << session->caps << dendl;
3929 goto ignore;
3930 }
3931
3932 if (!osdmap.is_up(from) ||
3933 !osdmap.get_addrs(from).legacy_equals(m->get_orig_source_addrs())) {
3934 dout(7) << "preprocess_alive ignoring alive message from down "
3935 << m->get_orig_source() << " " << m->get_orig_source_addrs()
3936 << dendl;
3937 goto ignore;
3938 }
3939
3940 if (osdmap.get_up_thru(from) >= m->want) {
3941 // yup.
3942 dout(7) << "preprocess_alive want up_thru " << m->want << " dup from " << m->get_orig_source_inst() << dendl;
3943 _reply_map(op, m->version);
3944 return true;
3945 }
3946
3947 dout(10) << "preprocess_alive want up_thru " << m->want
3948 << " from " << m->get_orig_source_inst() << dendl;
3949 return false;
3950
3951 ignore:
3952 mon.no_reply(op);
3953 return true;
3954}
3955
3956bool OSDMonitor::prepare_alive(MonOpRequestRef op)
3957{

Callers

nothing calls this directly

Calls 11

mark_osdmon_eventMethod · 0.80
get_orig_sourceMethod · 0.80
legacy_equalsMethod · 0.80
get_orig_source_addrsMethod · 0.80
no_replyMethod · 0.80
numMethod · 0.45
get_sessionMethod · 0.45
is_capableMethod · 0.45
is_upMethod · 0.45
get_addrsMethod · 0.45
get_orig_source_instMethod · 0.45

Tested by

no test coverage detected