]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/Session: inst -> name and addrs
authorSage Weil <sage@redhat.com>
Tue, 12 Jun 2018 17:39:55 +0000 (12:39 -0500)
committerSage Weil <sage@redhat.com>
Tue, 3 Jul 2018 18:01:24 +0000 (13:01 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/ConfigMonitor.cc
src/mon/LogMonitor.cc
src/mon/MDSMonitor.cc
src/mon/Monitor.cc
src/mon/Monitor.h
src/mon/OSDMonitor.cc
src/mon/Session.h

index 74ed0ad1ceee0591e383553bf278710584096d52..972378d1155cb45abde7c03e2dc1198ac688bde0 100644 (file)
@@ -747,8 +747,8 @@ bool ConfigMonitor::refresh_config(MonSession *s)
   }
 
   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;
@@ -779,7 +779,7 @@ bool ConfigMonitor::refresh_config(MonSession *s)
 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) {
@@ -790,7 +790,7 @@ bool ConfigMonitor::maybe_send_config(MonSession *s)
 
 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);
 }
index 9ea21ebea01be48a80013128e4b6a68b386f6bdd..9f270377d1ed7d0af34ab2d08455c75222498103 100644 (file)
@@ -583,7 +583,7 @@ void LogMonitor::check_sub(Subscription *s)
 
   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;
@@ -600,7 +600,7 @@ void LogMonitor::check_sub(Subscription *s)
     _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;
   
index 6736c2e115ae46a3fa80230863f5677eb4759fd9..58eb2cc9c00f21c063d9f14dfb4a60e56f926078 100644 (file)
@@ -1477,15 +1477,14 @@ void MDSMonitor::check_sub(Subscription *sub)
       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);
         }
@@ -1552,7 +1551,7 @@ void MDSMonitor::check_sub(Subscription *sub)
     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;
index 45a8ea4a9a1254ec46fce12238b1ab2703dc4fe2..12518f34c892dab58c55a0306f00a34eeb01c4e2 100644 (file)
@@ -3086,7 +3086,7 @@ void Monitor::handle_command(MonOpRequestRef op)
                         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);
@@ -3094,9 +3094,9 @@ void Monitor::handle_command(MonOpRequestRef op)
   }
 
   (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();
@@ -3717,7 +3717,8 @@ void Monitor::handle_forward(MonOpRequestRef op)
     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);
@@ -3902,7 +3903,7 @@ void Monitor::resend_routed_requests()
 
 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);
@@ -4032,7 +4033,9 @@ void Monitor::_ms_dispatch(Message *m)
     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});
@@ -4052,7 +4055,7 @@ void Monitor::_ms_dispatch(Message *m)
       s->authenticated = true;
     }
   } else {
-    dout(20) << __func__ << " existing session " << s << " for " << s->inst
+    dout(20) << __func__ << " existing session " << s << " for " << s->name
             << dendl;
   }
 
@@ -4925,7 +4928,7 @@ bool Monitor::ms_handle_reset(Connection *con)
 
   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);
@@ -5410,7 +5413,7 @@ void Monitor::tick()
       ++p;
     
       // don't trim monitors
-      if (s->inst.name.is_mon())
+      if (s->name.is_mon())
        continue;
 
       if (s->session_timeout < now && s->con) {
@@ -5419,12 +5422,13 @@ void Monitor::tick()
        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;
index d07612601a9e56b315dbd9c5f3e9923523d76cd0..3d3a1df6655d9d0fc80d35283315d48a660bfbf2 100644 (file)
@@ -834,7 +834,7 @@ public:
 
           // 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 ";
index fc6a3ccd12cb389c0def2b15739b7c396699e378..5ef6d7e0bb6dc854fe9bd73efb06da1db5d93fd7 100644 (file)
@@ -1503,7 +1503,8 @@ void OSDMonitor::share_map_with_random_osd()
     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.
@@ -3448,7 +3449,7 @@ void OSDMonitor::send_incremental(epoch_t first,
                                  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.
@@ -3456,7 +3457,7 @@ void OSDMonitor::send_incremental(epoch_t first,
     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;
   }
@@ -3817,13 +3818,13 @@ void OSDMonitor::check_pg_creates_subs()
 
 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);
   }
index d17758b9089d7837c3b46bb309e5f64c03490d84..6c97f686255fde1169bc5c7f29b5532572b81d5f 100644 (file)
@@ -42,41 +42,38 @@ struct MonSession : public RefCountedObject {
   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();
@@ -129,9 +126,9 @@ struct MonSessionMap {
     }
     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);
@@ -145,12 +142,14 @@ struct MonSessionMap {
     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);
     }
@@ -229,8 +228,10 @@ struct MonSessionMap {
 
 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;