]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: remove legacy MMonCommand handling
authorJohn Spray <john.spray@redhat.com>
Fri, 17 Mar 2017 10:32:45 +0000 (10:32 +0000)
committerJohn Spray <john.spray@redhat.com>
Tue, 21 Mar 2017 15:26:05 +0000 (11:26 -0400)
Fixes: http://tracker.ceph.com/issues/19288
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDSDaemon.cc
src/mds/MDSDaemon.h
src/mds/MDSRank.cc
src/mds/MDSRank.h

index ff5890b56b308c2bb6f66ec95cb190881a36515c..51f047ca6a10a3c1272b44e16580f2d40bf6aa28 100644 (file)
@@ -668,16 +668,6 @@ COMMAND("heap " \
        "mds", "*", "cli,rest")
 };
 
-// FIXME: reinstate issue_caps, try_eval,
-//  *if* it makes sense to do so (or should these be admin socket things?)
-
-/* This function DOES put the passed message before returning*/
-void MDSDaemon::handle_command(MMonCommand *m)
-{
-  bufferlist outbl;
-  _handle_command_legacy(m->cmd);
-  m->put();
-}
 
 int MDSDaemon::_handle_command(
     const cmdmap_t &cmdmap,
@@ -820,55 +810,6 @@ out:
   return r;
 }
 
-/**
- * Legacy "mds tell", takes a simple array of args
- */
-int MDSDaemon::_handle_command_legacy(std::vector<std::string> args)
-{
-  dout(10) << "handle_command args: " << args << dendl;
-  if (args[0] == "injectargs") {
-    if (args.size() < 2) {
-      derr << "Ignoring empty injectargs!" << dendl;
-    }
-    else {
-      std::ostringstream oss;
-      mds_lock.Unlock();
-      g_conf->injectargs(args[1], &oss);
-      mds_lock.Lock();
-      derr << "injectargs:" << dendl;
-      derr << oss.str() << dendl;
-    }
-  }
-  else if (args[0] == "exit") {
-    suicide();
-  }
-  else if (args[0] == "respawn") {
-    respawn();
-  }
-  else if (args[0] == "cpu_profiler") {
-    ostringstream ss;
-    cpu_profiler_handle_command(args, ss);
-    clog->info() << ss.str();
-  }
-  else if (args[0] == "heap") {
-    if (!ceph_using_tcmalloc())
-      clog->info() << "tcmalloc not enabled, can't use heap profiler commands";
-    else {
-      ostringstream ss;
-      vector<std::string> cmdargs;
-      cmdargs.insert(cmdargs.begin(), args.begin()+1, args.end());
-      ceph_heap_profiler_handle_command(cmdargs, ss);
-      clog->info() << ss.str();
-    }
-  } else {
-    if (!(mds_rank && mds_rank->handle_command_legacy(args))) {
-      dout(0) << "unrecognized command! " << args << dendl;
-    }
-  }
-
-  return 0;
-}
-
 /* This function deletes the passed message before returning. */
 
 void MDSDaemon::handle_mds_map(MMDSMap *m)
@@ -1187,12 +1128,6 @@ bool MDSDaemon::handle_core_message(Message *m)
     handle_mds_map(static_cast<MMDSMap*>(m));
     break;
 
-    // misc
-  case MSG_MON_COMMAND:
-    ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON);
-    handle_command(static_cast<MMonCommand*>(m));
-    break;
-
     // OSD
   case MSG_COMMAND:
     handle_command(static_cast<MCommand*>(m));
@@ -1206,6 +1141,12 @@ bool MDSDaemon::handle_core_message(Message *m)
     m->put();
     break;
 
+  case MSG_MON_COMMAND:
+    ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON);
+    clog->warn() << "dropping `mds tell` command from legacy monitor";
+    m->put();
+    break;
+
   default:
     return false;
   }
index 71f861bd8b45a2c9f8510577360b543715783d40..835fce67d01d1f374f5e4ec934ec402f2fc93d38 100644 (file)
@@ -170,7 +170,6 @@ protected:
   friend class C_MDS_Send_Command_Reply;
   static void send_command_reply(MCommand *m, MDSRank* mds_rank, int r,
                                 bufferlist outbl, const std::string& outs);
-  int _handle_command_legacy(std::vector<std::string> args);
   int _handle_command(
       const cmdmap_t &cmdmap,
       MCommand *m,
@@ -178,7 +177,6 @@ protected:
       std::string *outs,
       Context **run_later,
       bool *need_reply);
-  void handle_command(class MMonCommand *m);
   void handle_command(class MCommand *m);
   void handle_mds_map(class MMDSMap *m);
   void _handle_mds_map(MDSMap *oldmap);
index 6ebf5a5988b7adf17ddd85b6a5ad61286796371f..46a39dc8f467c62a46177d63ff9a9abcd3ac2670 100644 (file)
@@ -2517,91 +2517,6 @@ void MDSRank::bcast_mds_map()
   last_client_mdsmap_bcast = mdsmap->get_epoch();
 }
 
-
-bool MDSRankDispatcher::handle_command_legacy(std::vector<std::string> args)
-{
-  if (args[0] == "dumpcache") {
-    if (args.size() > 1)
-      mdcache->dump_cache(args[1].c_str());
-    else
-      mdcache->dump_cache();
-  }
-  else if (args[0] == "session" && args[1] == "kill") {
-    std::stringstream ss;
-    bool killed = kill_session(strtol(args[2].c_str(), 0, 10), false, ss);
-    if (!killed)
-      dout(15) << ss.str() << dendl;
-
-  } else if (args[0] == "issue_caps") {
-    long inum = strtol(args[1].c_str(), 0, 10);
-    CInode *in = mdcache->get_inode(inodeno_t(inum));
-    if (in) {
-      bool r = locker->issue_caps(in);
-      dout(20) << "called issue_caps on inode "  << inum
-              << " with result " << r << dendl;
-    } else dout(15) << "inode " << inum << " not in mdcache!" << dendl;
-  } else if (args[0] == "try_eval") {
-    long inum = strtol(args[1].c_str(), 0, 10);
-    int mask = strtol(args[2].c_str(), 0, 10);
-    CInode * ino = mdcache->get_inode(inodeno_t(inum));
-    if (ino) {
-      locker->try_eval(ino, mask);
-      dout(20) << "try_eval(" << inum << ", " << mask << ")" << dendl;
-    } else dout(15) << "inode " << inum << " not in mdcache!" << dendl;
-  } else if (args[0] == "fragment_dir") {
-    if (mdsmap->allows_dirfrags()) {
-      if (args.size() == 4) {
-       filepath fp(args[1].c_str());
-       CInode *in = mdcache->cache_traverse(fp);
-       if (in) {
-         frag_t fg;
-         if (fg.parse(args[2].c_str())) {
-           CDir *dir = in->get_dirfrag(fg);
-           if (dir) {
-             if (dir->is_auth()) {
-               int by = atoi(args[3].c_str());
-               if (by)
-                 mdcache->split_dir(dir, by);
-               else
-                 dout(0) << "need to split by >0 bits" << dendl;
-             } else dout(0) << "dir " << dir->dirfrag() << " not auth" << dendl;
-           } else dout(0) << "dir " << in->ino() << " " << fg << " dne" << dendl;
-         } else dout(0) << " frag " << args[2] << " does not parse" << dendl;
-       } else dout(0) << "path " << fp << " not found" << dendl;
-      } else dout(0) << "bad syntax" << dendl;
-    } else dout(0) << "dirfrags are disallowed by the mds map!" << dendl;
-  } else if (args[0] == "merge_dir") {
-    if (args.size() == 3) {
-      filepath fp(args[1].c_str());
-      CInode *in = mdcache->cache_traverse(fp);
-      if (in) {
-       frag_t fg;
-       if (fg.parse(args[2].c_str())) {
-         mdcache->merge_dir(in, fg);
-       } else dout(0) << " frag " << args[2] << " does not parse" << dendl;
-      } else dout(0) << "path " << fp << " not found" << dendl;
-    } else dout(0) << "bad syntax" << dendl;
-  } else if (args[0] == "export_dir") {
-    if (args.size() == 3) {
-      filepath fp(args[1].c_str());
-      mds_rank_t target = mds_rank_t(atoi(args[2].c_str()));
-      if (target != whoami && mdsmap->is_up(target) && mdsmap->is_in(target)) {
-       CInode *in = mdcache->cache_traverse(fp);
-       if (in) {
-         CDir *dir = in->get_dirfrag(frag_t());
-         if (dir && dir->is_auth()) {
-           mdcache->migrator->export_dir(dir, target);
-         } else dout(0) << "bad export_dir path dirfrag frag_t() or dir not auth" << dendl;
-       } else dout(0) << "bad export_dir path" << dendl;
-      } else dout(0) << "bad export_dir target syntax" << dendl;
-    } else dout(0) << "bad export_dir syntax" << dendl;
-  } else {
-    return false;
-  }
-
-  return true;
-}
-
 MDSRankDispatcher::MDSRankDispatcher(
     mds_rank_t whoami_,
     Mutex &mds_lock_,
index c8749ff33a9073470b67dc9bd5859e9d1809d9f9..e8d7af2fc5ce1454f6f39f3f1f247885cbffcf3a 100644 (file)
@@ -515,7 +515,6 @@ public:
   void handle_osd_map();
   bool kill_session(int64_t session_id, bool wait, std::stringstream& ss);
   void update_log_config();
-  bool handle_command_legacy(std::vector<std::string> args);
 
   bool handle_command(
     const cmdmap_t &cmdmap,