]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add helper ::set_val to change fs settings
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 7 Jul 2023 16:14:58 +0000 (12:14 -0400)
committerDhairya Parmar <dparmar@redhat.com>
Mon, 25 Dec 2023 13:33:36 +0000 (19:03 +0530)
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mon/FSCommands.cc
src/mon/FSCommands.h

index 2606199690788d4fa97492b2c2affa3bf68f1cf1..e73d13d34564e394641318d861d8307b13aa9e92 100644 (file)
@@ -328,13 +328,22 @@ public:
       return -EINVAL;
     }
     string val;
-    string interr;
-    int64_t n = 0;
     if (!cmd_getval(cmdmap, "val", val)) {
       return -EINVAL;
     }
+
+    return set_val(mon, fsmap, op, cmdmap, ss, fsp, var, val);
+  }
+};
+
+int FileSystemCommandHandler::set_val(Monitor *mon, FSMap& fsmap, MonOpRequestRef op,
+            const cmdmap_t& cmdmap, std::ostream &ss, Filesystem const* fsp,
+            std::string var, std::string val)
+{
+  {
+    std::string interr;
     // we got a string.  see if it contains an int.
-    n = strict_strtoll(val.c_str(), 10, &interr);
+    int64_t n = strict_strtoll(val.c_str(), 10, &interr);
     if (var == "max_mds") {
       // NOTE: see also "mds set_max_mds", which can modify the same field.
       if (interr.length()) {
@@ -762,10 +771,9 @@ public:
       ss << "unknown variable " << var;
       return -EINVAL;
     }
-
-    return 0;
   }
-};
+  return 0;
+}
 
 class CompatSetHandler : public FileSystemCommandHandler
 {
index cd9009724e089d9e28843d6892690097ca245c2b..09ffda54cc6a6f2fe4c8dd26f8418804bee535d3 100644 (file)
@@ -52,6 +52,8 @@ protected:
 
   virtual std::string const &get_prefix() const {return prefix;}
 
+  int set_val(Monitor *mon, FSMap& fsmap, MonOpRequestRef op, const cmdmap_t& cmdmap, std::ostream &ss, Filesystem const* fsp, std::string var, std::string val);
+
 public:
   FileSystemCommandHandler(const std::string &prefix_)
     : prefix(prefix_)