]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph-bluestore-tool: aliases for --path and --command options.
authorIgor Fedotov <igor.fedotov@croit.io>
Mon, 15 Jan 2024 14:50:57 +0000 (17:50 +0300)
committerIgor Fedotov <igor.fedotov@croit.io>
Wed, 5 Mar 2025 18:42:36 +0000 (21:42 +0300)
Introduce --data-path and --op respectively to match
ceph-objectstore-tool options.

Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
(cherry picked from commit c0983e9c98903b7f91907c9d46c8497323fd4238)

src/os/bluestore/bluestore_tool.cc

index 2126c436d17d08a5e0579bbb62cf817f8caefe12..9f19b5c17cc63493c39edd990c1fe1a24152f5d4 100644 (file)
@@ -278,8 +278,8 @@ int main(int argc, char **argv)
   vector<string> devs;
   vector<string> devs_source;
   string dev_target;
-  string path;
-  string action;
+  string path, path_aux;
+  string action, action_aux;
   string log_file;
   string input_file;
   string dest_file;
@@ -295,6 +295,8 @@ int main(int argc, char **argv)
     ("help,h", "produce help message")
     (",i", po::value<string>(&osd_instance), "OSD instance. Requires access to monitor/ceph.conf")
     ("path", po::value<string>(&path), "bluestore path")
+    ("data-path", po::value<string>(&path_aux),
+      "--path alias, ignored if the latter is present")
     ("out-dir", po::value<string>(&out_dir), "output directory")
     ("input-file", po::value<string>(&input_file), "import file")
     ("dest-file", po::value<string>(&dest_file), "destination file")
@@ -310,6 +312,8 @@ int main(int argc, char **argv)
     ("yes-i-really-really-mean-it", "additional confirmation for dangerous commands")
     ("sharding", po::value<string>(&new_sharding), "new sharding to apply")
     ("resharding-ctrl", po::value<string>(&resharding_ctrl), "gives control over resharding procedure details")
+    ("op", po::value<string>(&action_aux),
+      "--command alias, ignored if the latter is present")
     ;
   po::options_description po_positional("Positional options");
   po_positional.add_options()
@@ -361,6 +365,26 @@ int main(int argc, char **argv)
     std::cerr << e.what() << std::endl;
     exit(EXIT_FAILURE);
   }
+  if (action != action_aux && !action.empty() && !action_aux.empty()) {
+    std::cerr
+      << " Ambiguous --op and --command options, please provide a single one."
+      << std::endl;
+    exit(EXIT_FAILURE);
+  }
+  if (action.empty()) {
+    action.swap(action_aux);
+  }
+  if (!path_aux.empty()) {
+    if (path.empty()) {
+      path.swap(path_aux);
+    } else if (path != path_aux) {
+      std::cerr
+       << " Ambiguous --data-path and --path options, please provide a single one."
+       << std::endl;
+      exit(EXIT_FAILURE);
+    }
+  };
+
   // normalize path (remove ending '/' if any)
   if (path.size() > 1 && *(path.end() - 1) == '/') {
     path.resize(path.size() - 1);