]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs: obsolete deprecated mds commands
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 25 Aug 2017 21:06:03 +0000 (14:06 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Sun, 1 Oct 2017 23:47:15 +0000 (16:47 -0700)
Fixes: http://tracker.ceph.com/issues/20596
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mon/FSCommands.cc
src/mon/MDSMonitor.cc
src/mon/MDSMonitor.h
src/mon/MonCommands.h

index 1e4ead537260da2693fb9a5774d0a2d51c5d32f8..49d4bf5cd9d6ef8ecc4572d3ace3e3a9be1a60fa 100644 (file)
@@ -748,48 +748,6 @@ class RemoveDataPoolHandler : public FileSystemCommandHandler
   }
 };
 
-
-/**
- * For commands that refer to a particular filesystem,
- * enable wrapping to implement the legacy version of
- * the command (like "mds add_data_pool" vs "fs add_data_pool")
- *
- * The wrapped handler must expect a fs_name argument in
- * its command map.
- */
-template<typename T>
-class LegacyHandler : public T
-{
-  std::string legacy_prefix;
-
-  public:
-  template <typename... Args>
-  LegacyHandler(const std::string &new_prefix, Args&&... args)
-    : T(std::forward<Args>(args)...)
-  {
-    legacy_prefix = new_prefix;
-  }
-
-  std::string const &get_prefix() override {return legacy_prefix;}
-
-  int handle(
-      Monitor *mon,
-      FSMap &fsmap,
-      MonOpRequestRef op,
-      map<string, cmd_vartype> &cmdmap,
-      std::stringstream &ss) override
-  {
-    auto fs = fsmap.get_legacy_filesystem();
-    if (fs == nullptr) {
-      ss << "No filesystem configured";
-      return -ENOENT;
-    }
-    std::map<string, cmd_vartype> modified = cmdmap;
-    modified["fs_name"] = fs->mds_map.get_fs_name();
-    return T::handle(mon, fsmap, op, modified, ss);
-  }
-};
-
 /**
  * For commands with an alternative prefix
  */
@@ -825,16 +783,9 @@ FileSystemCommandHandler::load(Paxos *paxos)
   std::list<std::shared_ptr<FileSystemCommandHandler> > handlers;
 
   handlers.push_back(std::make_shared<SetHandler>());
-  handlers.push_back(std::make_shared<LegacyHandler<SetHandler> >("mds set"));
   handlers.push_back(std::make_shared<FlagSetHandler>());
   handlers.push_back(std::make_shared<AddDataPoolHandler>(paxos));
-  handlers.push_back(std::make_shared<LegacyHandler<AddDataPoolHandler> >(
-        "mds add_data_pool", paxos));
   handlers.push_back(std::make_shared<RemoveDataPoolHandler>());
-  handlers.push_back(std::make_shared<LegacyHandler<RemoveDataPoolHandler> >(
-        "mds remove_data_pool"));
-  handlers.push_back(std::make_shared<LegacyHandler<RemoveDataPoolHandler> >(
-        "mds rm_data_pool"));
   handlers.push_back(std::make_shared<FsNewHandler>(paxos));
   handlers.push_back(std::make_shared<RemoveFilesystemHandler>());
   handlers.push_back(std::make_shared<ResetFilesystemHandler>());
index bae812a95da633aafb3e82ba550670a89c143a7f..545125c51b5a1b736e5ad270971131cf022ff5c6 100644 (file)
@@ -864,53 +864,6 @@ bool MDSMonitor::preprocess_command(MonOpRequestRef op)
       ds << fsmap;
     }
     r = 0;
-  } else if (prefix == "mds dump") {
-    int64_t epocharg;
-    epoch_t epoch;
-
-    FSMap *p = &fsmap;
-    if (cmd_getval(g_ceph_context, cmdmap, "epoch", epocharg)) {
-      epoch = epocharg;
-      bufferlist b;
-      int err = get_version(epoch, b);
-      if (err == -ENOENT) {
-       p = 0;
-       r = -ENOENT;
-      } else {
-       assert(err == 0);
-       assert(b.length());
-       p = new FSMap;
-       p->decode(b);
-      }
-    }
-    if (p) {
-      stringstream ds;
-      const MDSMap *mdsmap = nullptr;
-      MDSMap blank;
-      blank.epoch = fsmap.epoch;
-      if (fsmap.legacy_client_fscid != FS_CLUSTER_ID_NONE) {
-        mdsmap = &(fsmap.filesystems[fsmap.legacy_client_fscid]->mds_map);
-      } else {
-        mdsmap = &blank;
-      }
-      if (f != NULL) {
-       f->open_object_section("mdsmap");
-       mdsmap->dump(f.get());
-       f->close_section();
-       f->flush(ds);
-       r = 0;
-      } else {
-       mdsmap->print(ds);
-       r = 0;
-      }
-
-      rdata.append(ds);
-      ss << "dumped fsmap epoch " << p->get_epoch();
-
-      if (p != &fsmap) {
-       delete p;
-      }
-    }
   } else if (prefix == "fs dump") {
     int64_t epocharg;
     epoch_t epoch;
@@ -1004,29 +957,6 @@ bool MDSMonitor::preprocess_command(MonOpRequestRef op)
     count_metadata(field, f.get());
     f->flush(ds);
     r = 0;
-  } else if (prefix == "mds getmap") {
-    epoch_t e;
-    int64_t epocharg;
-    bufferlist b;
-    if (cmd_getval(g_ceph_context, cmdmap, "epoch", epocharg)) {
-      e = epocharg;
-      int err = get_version(e, b);
-      if (err == -ENOENT) {
-       r = -ENOENT;
-      } else {
-       assert(err == 0);
-       assert(b.length());
-       FSMap mm;
-       mm.decode(b);
-       mm.encode(rdata, m->get_connection()->get_features());
-       ss << "got fsmap epoch " << mm.get_epoch();
-       r = 0;
-      }
-    } else {
-      fsmap.encode(rdata, m->get_connection()->get_features());
-      ss << "got fsmap epoch " << fsmap.get_epoch();
-      r = 0;
-    }
   } else if (prefix == "mds compat show") {
       if (f) {
        f->open_object_section("mds_compat");
@@ -1298,8 +1228,6 @@ bool MDSMonitor::prepare_command(MonOpRequestRef op)
     goto out;
   }
 
-  r = legacy_filesystem_command(op, prefix, cmdmap, ss);
-
   if (r == -ENOSYS && ss.str().empty()) {
     ss << "unrecognized command";
   }
@@ -1359,9 +1287,7 @@ int MDSMonitor::filesystem_command(
   string whostr;
   cmd_getval(g_ceph_context, cmdmap, "who", whostr);
 
-  if (prefix == "mds stop" ||
-      prefix == "mds deactivate") {
-
+  if (prefix == "mds deactivate") {
     mds_role_t role;
     r = parse_role(whostr, &role, ss);
     if (r < 0 ) {
@@ -1538,99 +1464,6 @@ int MDSMonitor::filesystem_command(
   return r;
 }
 
-/**
- * Helper to legacy_filesystem_command
- */
-void MDSMonitor::modify_legacy_filesystem(
-    std::function<void(std::shared_ptr<Filesystem> )> fn)
-{
-  pending_fsmap.modify_filesystem(
-    pending_fsmap.legacy_client_fscid,
-    fn
-  );
-}
-
-
-
-/**
- * Handle a command that affects the filesystem (i.e. a filesystem
- * must exist for the command to act upon).
- *
- * @retval 0        Command was successfully handled and has side effects
- * @retval -EAGAIN  Messages has been requeued for retry
- * @retval -ENOSYS  Unknown command
- * @retval < 0      An error has occurred; **ss** may have been set.
- */
-int MDSMonitor::legacy_filesystem_command(
-    MonOpRequestRef op,
-    std::string const &prefix,
-    map<string, cmd_vartype> &cmdmap,
-    std::stringstream &ss)
-{
-  dout(4) << __func__ << " prefix='" << prefix << "'" << dendl;
-  op->mark_mdsmon_event(__func__);
-  int r = 0;
-  string whostr;
-  cmd_getval(g_ceph_context, cmdmap, "who", whostr);
-
-  assert (pending_fsmap.legacy_client_fscid != FS_CLUSTER_ID_NONE);
-
-  if (prefix == "mds set_max_mds") {
-    // NOTE: deprecated by "fs set max_mds"
-    int64_t maxmds;
-    if (!cmd_getval(g_ceph_context, cmdmap, "maxmds", maxmds) || maxmds <= 0) {
-      return -EINVAL;
-    }
-
-    const MDSMap& mdsmap =
-      pending_fsmap.filesystems.at(pending_fsmap.legacy_client_fscid)->mds_map;
-      
-    if (!mdsmap.allows_multimds() &&
-       maxmds > mdsmap.get_max_mds() &&
-       maxmds > 1) {
-      ss << "multi-MDS clusters are not enabled; set 'allow_multimds' to enable";
-      return -EINVAL;
-    }
-
-    if (maxmds > MAX_MDS) {
-      ss << "may not have more than " << MAX_MDS << " MDS ranks";
-      return -EINVAL;
-    }
-
-    modify_legacy_filesystem(
-        [maxmds](std::shared_ptr<Filesystem> fs)
-    {
-      fs->mds_map.set_max_mds(maxmds);
-    });
-
-    r = 0;
-    ss << "max_mds = " << maxmds;
-  } else if (prefix == "mds cluster_down") {
-    // NOTE: deprecated by "fs set cluster_down"
-    modify_legacy_filesystem(
-        [](std::shared_ptr<Filesystem> fs)
-    {
-      fs->mds_map.set_flag(CEPH_MDSMAP_DOWN);
-    });
-    ss << "marked fsmap DOWN";
-    r = 0;
-  } else if (prefix == "mds cluster_up") {
-    // NOTE: deprecated by "fs set cluster_up"
-    modify_legacy_filesystem(
-        [](std::shared_ptr<Filesystem> fs)
-    {
-      fs->mds_map.clear_flag(CEPH_MDSMAP_DOWN);
-    });
-    ss << "unmarked fsmap DOWN";
-    r = 0;
-  } else {
-    return -ENOSYS;
-  }
-
-  return r;
-}
-
-
 void MDSMonitor::check_subs()
 {
   std::list<std::string> types;
index afaaa7e72cafe526d64416180bb72820709bc47d..840f4e469a524f59a9a8972cdc7c0df7e7fd7b30 100644 (file)
@@ -96,13 +96,6 @@ class MDSMonitor : public PaxosService {
       mds_role_t *role,
       std::ostream &ss);
 
-  void modify_legacy_filesystem(
-      std::function<void(std::shared_ptr<Filesystem> )> fn);
-  int legacy_filesystem_command(
-      MonOpRequestRef op,
-      std::string const &prefix,
-      map<string, cmd_vartype> &cmdmap,
-      std::stringstream &ss);
   int filesystem_command(
       MonOpRequestRef op,
       std::string const &prefix,
index d8f743f3416e3769cdf9d7effd3bbf9525c375c9..0c29484b180e48bd1946768391c29b0ca028dd14 100644 (file)
@@ -284,13 +284,13 @@ COMMAND("mds stat", "show MDS status", "mds", "r", "cli,rest")
 COMMAND_WITH_FLAG("mds dump "
        "name=epoch,type=CephInt,req=false,range=0", \
        "dump legacy MDS cluster info, optionally from epoch",
-        "mds", "r", "cli,rest", FLAG(DEPRECATED))
+        "mds", "r", "cli,rest", FLAG(OBSOLETE))
 COMMAND("fs dump "
        "name=epoch,type=CephInt,req=false,range=0", \
        "dump all CephFS status, optionally from epoch", "mds", "r", "cli,rest")
 COMMAND_WITH_FLAG("mds getmap " \
        "name=epoch,type=CephInt,req=false,range=0", \
-       "get MDS map, optionally from epoch", "mds", "r", "cli,rest", FLAG(DEPRECATED))
+       "get MDS map, optionally from epoch", "mds", "r", "cli,rest", FLAG(OBSOLETE))
 COMMAND("mds metadata name=who,type=CephString,req=false",
        "fetch metadata for mds <who>",
        "mds", "r", "cli,rest")
@@ -307,19 +307,19 @@ COMMAND_WITH_FLAG("mds tell " \
 COMMAND("mds compat show", "show mds compatibility settings", \
        "mds", "r", "cli,rest")
 COMMAND_WITH_FLAG("mds stop name=who,type=CephString", "stop mds", \
-       "mds", "rw", "cli,rest", FLAG(DEPRECATED))
+       "mds", "rw", "cli,rest", FLAG(OBSOLETE))
 COMMAND("mds deactivate name=who,type=CephString",
         "clean up specified MDS rank (use with `set max_mds` to shrink cluster)", \
        "mds", "rw", "cli,rest")
 COMMAND_WITH_FLAG("mds set_max_mds " \
        "name=maxmds,type=CephInt,range=0", \
-       "set max MDS index", "mds", "rw", "cli,rest", FLAG(DEPRECATED))
+       "set max MDS index", "mds", "rw", "cli,rest", FLAG(OBSOLETE))
 COMMAND_WITH_FLAG("mds set " \
        "name=var,type=CephChoices,strings=max_mds|max_file_size"
        "|allow_new_snaps|inline_data|allow_multimds|allow_dirfrags " \
        "name=val,type=CephString "                                     \
        "name=confirm,type=CephString,req=false",                       \
-       "set mds parameter <var> to <val>", "mds", "rw", "cli,rest", FLAG(DEPRECATED))
+       "set mds parameter <var> to <val>", "mds", "rw", "cli,rest", FLAG(OBSOLETE))
 // arbitrary limit 0-20 below; worth standing on head to make it
 // relate to actual state definitions?
 // #include "include/ceph_fs.h"
@@ -337,8 +337,8 @@ COMMAND("mds rm " \
        "remove nonactive mds", "mds", "rw", "cli,rest")
 COMMAND("mds rmfailed name=who,type=CephString name=confirm,type=CephString,req=false", \
        "remove failed mds", "mds", "rw", "cli,rest")
-COMMAND_WITH_FLAG("mds cluster_down", "take MDS cluster down", "mds", "rw", "cli,rest", FLAG(DEPRECATED))
-COMMAND_WITH_FLAG("mds cluster_up", "bring MDS cluster up", "mds", "rw", "cli,rest", FLAG(DEPRECATED))
+COMMAND_WITH_FLAG("mds cluster_down", "take MDS cluster down", "mds", "rw", "cli,rest", FLAG(OBSOLETE))
+COMMAND_WITH_FLAG("mds cluster_up", "bring MDS cluster up", "mds", "rw", "cli,rest", FLAG(OBSOLETE))
 COMMAND("mds compat rm_compat " \
        "name=feature,type=CephInt,range=0", \
        "remove compatible feature", "mds", "rw", "cli,rest")
@@ -347,13 +347,13 @@ COMMAND("mds compat rm_incompat " \
        "remove incompatible feature", "mds", "rw", "cli,rest")
 COMMAND_WITH_FLAG("mds add_data_pool " \
        "name=pool,type=CephString", \
-       "add data pool <pool>", "mds", "rw", "cli,rest", FLAG(DEPRECATED))
+       "add data pool <pool>", "mds", "rw", "cli,rest", FLAG(OBSOLETE))
 COMMAND_WITH_FLAG("mds remove_data_pool " \
        "name=pool,type=CephString", \
-       "remove data pool <pool>", "mds", "rw", "cli,rest", FLAG(DEPRECATED))
+       "remove data pool <pool>", "mds", "rw", "cli,rest", FLAG(OBSOLETE))
 COMMAND_WITH_FLAG("mds rm_data_pool " \
        "name=pool,type=CephString", \
-       "remove data pool <pool>", "mds", "rw", "cli,rest", FLAG(DEPRECATED))
+       "remove data pool <pool>", "mds", "rw", "cli,rest", FLAG(OBSOLETE))
 COMMAND_WITH_FLAG("mds newfs " \
        "name=metadata,type=CephInt,range=0 " \
        "name=data,type=CephInt,range=0 " \