]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: Add --backend option to ceph-osdomap-tool default to rocksdb
authorDavid Zafman <dzafman@redhat.com>
Wed, 13 Sep 2017 01:06:10 +0000 (18:06 -0700)
committerDavid Zafman <dzafman@redhat.com>
Wed, 13 Sep 2017 21:06:24 +0000 (14:06 -0700)
Fix hard-coded "leveldb" backend.  The command is broken in Luminous
now that "rocksdb" is the default.

Signed-off-by: David Zafman <dzafman@redhat.com>
src/tools/ceph_osdomap_tool.cc

index e203c2a02e0ad90f825273e5abbb94003401950b..13e443664b8934576d8184f46353c8504cf03956 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 
 int main(int argc, char **argv) {
   po::options_description desc("Allowed options");
-  string store_path, cmd, oid;
+  string store_path, cmd, oid, backend;
   bool debug = false;
   desc.add_options()
     ("help", "produce help message")
@@ -38,6 +38,8 @@ int main(int argc, char **argv) {
     ("oid", po::value<string>(&oid), "Restrict to this object id when dumping objects")
     ("command", po::value<string>(&cmd),
      "command arg is one of [dump-raw-keys, dump-raw-key-vals, dump-objects, dump-objects-with-keys, check, dump-headers, repair], mandatory")
+    ("backend", po::value<string>(&backend),
+     "DB backend (default rocksdb)")
     ;
   po::positional_options_description p;
   p.add("command", 1);
@@ -96,7 +98,15 @@ int main(int argc, char **argv) {
     return 1;
   }
 
-  KeyValueDB* store(KeyValueDB::create(g_ceph_context, "leveldb", store_path));
+  if (vm.count("backend") == 0) {
+    backend = "rocksdb";
+  }
+
+  KeyValueDB* store(KeyValueDB::create(g_ceph_context, backend, store_path));
+  if (store == NULL) {
+    std::cerr << "Invalid backend '" << backend << "' specified" << std::endl;
+    return 1;
+  }
   /*if (vm.count("paranoid")) {
     std::cerr << "Enabling paranoid checks" << std::endl;
     store->options.paranoid_checks = true;