tools: Add --backend option to ceph-osdomap-tool default to rocksdb

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>
This commit is contained in:
David Zafman 2017-09-12 18:06:10 -07:00
parent 30c92d0a17
commit de43493990

View 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;