}
string device_class;
- if (s->inst.name.is_osd()) {
- const char *c = osdmap.crush->get_item_class(s->inst.name.num());
+ if (s->name.is_osd()) {
+ const char *c = osdmap.crush->get_item_class(s->name.num());
if (c) {
device_class = c;
dout(10) << __func__ << " device_class " << device_class << dendl;
bool ConfigMonitor::maybe_send_config(MonSession *s)
{
bool changed = refresh_config(s);
- dout(10) << __func__ << " to " << s->inst << " "
+ dout(10) << __func__ << " to " << s->name << " "
<< (changed ? "(changed)" : "(unchanged)")
<< dendl;
if (changed) {
void ConfigMonitor::send_config(MonSession *s)
{
- dout(10) << __func__ << " to " << s->inst << dendl;
+ dout(10) << __func__ << " to " << s->name << dendl;
auto m = new MConfig(s->last_config);
s->con->send_message(m);
}
version_t summary_version = summary.version;
if (s->next > summary_version) {
- dout(10) << __func__ << " client " << s->session->inst
+ dout(10) << __func__ << " client " << s->session->name
<< " requested version (" << s->next << ") is greater than ours ("
<< summary_version << "), which means we already sent him"
<< " everything we have." << dendl;
_create_sub_incremental(mlog, sub_level, s->next);
}
- dout(1) << __func__ << " sending message to " << s->session->inst
+ dout(1) << __func__ << " sending message to " << s->session->name
<< " with " << mlog->entries.size() << " entries"
<< " (version " << mlog->version << ")" << dendl;
return;
}
- const bool is_mds = sub->session->inst.name.is_mds();
+ const bool is_mds = sub->session->name.is_mds();
mds_gid_t mds_gid = MDS_GID_NONE;
fs_cluster_id_t fscid = FS_CLUSTER_ID_NONE;
if (is_mds) {
// What (if any) namespace are you assigned to?
auto mds_info = fsmap.get_mds_info();
for (const auto &p : mds_info) {
-#warning fixme
- if (p.second.addrs.legacy_addr() == sub->session->inst.addr) {
+ if (p.second.addrs == sub->session->addrs) {
mds_gid = p.first;
fscid = fsmap.mds_roles.at(mds_gid);
}
assert(mds_map != nullptr);
dout(10) << __func__ << " selected MDS map epoch " <<
mds_map->epoch << " for namespace " << fscid << " for subscriber "
- << sub->session->inst.name << " who wants epoch " << sub->next << dendl;
+ << sub->session->name << " who wants epoch " << sub->next << dendl;
if (sub->next > mds_map->epoch) {
return;
param_str_map, mon_cmd)) {
dout(1) << __func__ << " access denied" << dendl;
(cmd_is_rw ? audit_clog->info() : audit_clog->debug())
- << "from='" << session->inst << "' "
+ << "from='" << session->name << " " << session->addrs << "' "
<< "entity='" << session->entity_name << "' "
<< "cmd=" << m->cmd << ": access denied";
reply_command(op, -EACCES, "access denied", 0);
}
(cmd_is_rw ? audit_clog->info() : audit_clog->debug())
- << "from='" << session->inst << "' "
- << "entity='" << session->entity_name << "' "
- << "cmd=" << m->cmd << ": dispatch";
+ << "from='" << session->name << " " << session->addrs << "' "
+ << "entity='" << session->entity_name << "' "
+ << "cmd=" << m->cmd << ": dispatch";
if (mon_cmd->is_mgr()) {
const auto& hdr = m->get_header();
assert(req != NULL);
ConnectionRef c(new AnonConnection(cct));
- MonSession *s = new MonSession(req->get_source_inst(),
+ MonSession *s = new MonSession(req->get_source(),
+ req->get_source_addrs(),
static_cast<Connection*>(c.get()));
c->set_priv(RefCountedPtr{s, false});
c->set_peer_addr(m->client.addr);
void Monitor::remove_session(MonSession *s)
{
- dout(10) << "remove_session " << s << " " << s->inst
+ dout(10) << "remove_session " << s << " " << s->name << " " << s->addrs
<< " features 0x" << std::hex << s->con_features << std::dec << dendl;
assert(s->con);
assert(!s->closed);
ConnectionRef con = m->get_connection();
{
Mutex::Locker l(session_map_lock);
- s = session_map.new_session(m->get_source_inst(), con.get());
+ s = session_map.new_session(m->get_source(),
+ m->get_source_addrs(),
+ con.get());
}
assert(s);
con->set_priv(RefCountedPtr{s, false});
s->authenticated = true;
}
} else {
- dout(20) << __func__ << " existing session " << s << " for " << s->inst
+ dout(20) << __func__ << " existing session " << s << " for " << s->name
<< dendl;
}
Mutex::Locker l(lock);
- dout(10) << "reset/close on session " << s->inst << dendl;
+ dout(10) << "reset/close on session " << s->name << " " << s->addrs << dendl;
if (!s->closed) {
Mutex::Locker l(session_map_lock);
remove_session(s);
++p;
// don't trim monitors
- if (s->inst.name.is_mon())
+ if (s->name.is_mon())
continue;
if (s->session_timeout < now && s->con) {
s->session_timeout += g_conf->mon_session_timeout;
}
if (s->session_timeout < now) {
- dout(10) << " trimming session " << s->con << " " << s->inst
+ dout(10) << " trimming session " << s->con << " " << s->name
+ << " " << s->addrs
<< " (timeout " << s->session_timeout
<< " < now " << now << ")" << dendl;
} else if (out_for_too_long) {
// boot the client Session because we've taken too long getting back in
- dout(10) << " trimming session " << s->con << " " << s->inst
+ dout(10) << " trimming session " << s->con << " " << s->name
<< " because we've been out of quorum too long" << dendl;
} else {
continue;
// if client drops we may not have a session to draw information from.
if (s) {
- ss << "from='" << s->inst << "' "
+ ss << "from='" << s->name << " " << s->addrs << "' "
<< "entity='" << s->entity_name << "' ";
} else {
ss << "session dropped for command ";
return;
}
- dout(10) << "committed, telling random " << s->inst << " all about it" << dendl;
+ dout(10) << "committed, telling random " << s->name
+ << " all about it" << dendl;
// get feature of the peer
// use quorum_con_features, if it's an anonymous connection.
MonOpRequestRef req)
{
dout(5) << "send_incremental [" << first << ".." << osdmap.get_epoch() << "]"
- << " to " << session->inst << dendl;
+ << " to " << session->name << dendl;
// get feature of the peer
// use quorum_con_features, if it's an anonymous connection.
mon->get_quorum_con_features();
if (first <= session->osd_epoch) {
- dout(10) << __func__ << " " << session->inst << " should already have epoch "
+ dout(10) << __func__ << " " << session->name << " should already have epoch "
<< session->osd_epoch << dendl;
first = session->osd_epoch + 1;
}
void OSDMonitor::check_pg_creates_sub(Subscription *sub)
{
- dout(20) << __func__ << " .. " << sub->session->inst << dendl;
+ dout(20) << __func__ << " .. " << sub->session->name << dendl;
assert(sub->type == "osd_pg_creates");
// only send these if the OSD is up. we will check_subs() when they do
// come up so they will get the creates then.
- if (sub->session->inst.name.is_osd() &&
- mon->osdmon()->osdmap.is_up(sub->session->inst.name.num())) {
- sub->next = send_pg_creates(sub->session->inst.name.num(),
+ if (sub->session->name.is_osd() &&
+ mon->osdmon()->osdmap.is_up(sub->session->name.num())) {
+ sub->next = send_pg_creates(sub->session->name.num(),
sub->session->con.get(),
sub->next);
}
ConnectionRef con;
int con_type = 0;
uint64_t con_features = 0; // zero if AnonConnection
- entity_inst_t inst;
+ entity_name_t name;
+ entity_addrvec_t addrs;
utime_t session_timeout;
- bool closed;
+ bool closed = false;
xlist<MonSession*>::item item;
set<uint64_t> routed_request_tids;
MonCap caps;
- uint64_t auid;
- uint64_t global_id;
+ uint64_t auid = 0;
+ uint64_t global_id = 0;
bool authenticated = false; ///< true if auth handshake is complete
map<string, Subscription*> sub_map;
- epoch_t osd_epoch; // the osdmap epoch sent to the mon client
+ epoch_t osd_epoch = 0; ///< the osdmap epoch sent to the mon client
- AuthServiceHandler *auth_handler;
+ AuthServiceHandler *auth_handler = nullptr;
EntityName entity_name;
ConnectionRef proxy_con;
- uint64_t proxy_tid;
+ uint64_t proxy_tid = 0;
string remote_host; ///< remote host name
map<string,string> last_config; ///< most recently shared config
bool any_config = false;
- MonSession(const entity_inst_t& i, Connection *c) :
+ MonSession(const entity_name_t& n, const entity_addrvec_t& av, Connection *c) :
RefCountedObject(g_ceph_context),
con(c),
con_type(c->get_peer_type()),
- con_features(0),
- inst(i), closed(false), item(this),
- auid(0),
- global_id(0),
- osd_epoch(0),
- auth_handler(NULL),
- proxy_con(NULL), proxy_tid(0) {
+ name(n),
+ addrs(av),
+ item(this) {
if (c->get_messenger()) {
// only fill in features if this is a non-anonymous connection
con_features = c->get_features();
}
s->sub_map.clear();
s->item.remove_myself();
- if (s->inst.name.is_osd()) {
- for (multimap<int,MonSession*>::iterator p = by_osd.find(s->inst.name.num());
- p->first == s->inst.name.num();
+ if (s->name.is_osd()) {
+ for (multimap<int,MonSession*>::iterator p = by_osd.find(s->name.num());
+ p->first == s->name.num();
++p)
if (p->second == s) {
by_osd.erase(p);
s->put();
}
- MonSession *new_session(const entity_inst_t& i, Connection *c) {
- MonSession *s = new MonSession(i, c);
+ MonSession *new_session(const entity_name_t& n,
+ const entity_addrvec_t& av,
+ Connection *c) {
+ MonSession *s = new MonSession(n, av, c);
assert(s);
sessions.push_back(&s->item);
- if (i.name.is_osd())
- by_osd.insert(pair<int,MonSession*>(i.name.num(), s));
+ if (n.is_osd())
+ by_osd.insert(pair<int,MonSession*>(n.num(), s));
if (s->con_features) {
feature_map.add(s->con_type, s->con_features);
}
inline ostream& operator<<(ostream& out, const MonSession& s)
{
- out << "MonSession(" << s.inst << " is " << (s.closed ? "closed" : "open")
- << " " << s.caps << ", features 0x" << std::hex << s.con_features << std::dec
+ out << "MonSession(" << s.name << " " << s.addrs
+ << " is " << (s.closed ? "closed" : "open")
+ << " " << s.caps
+ << ", features 0x" << std::hex << s.con_features << std::dec
<< " (" << ceph_release_name(ceph_release_from_features(s.con_features))
<< "))";
return out;