Skip to content

Commit c0983e9

Browse files
committed
tools/ceph-bluestore-tool: aliases for --path and --command options.
Introduce --data-path and --op respectively to match ceph-objectstore-tool options. Signed-off-by: Igor Fedotov <[email protected]>
1 parent 410d474 commit c0983e9

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/os/bluestore/bluestore_tool.cc

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ int main(int argc, char **argv)
278278
vector<string> devs;
279279
vector<string> devs_source;
280280
string dev_target;
281-
string path;
282-
string action;
281+
string path, path_aux;
282+
string action, action_aux;
283283
string log_file;
284284
string input_file;
285285
string dest_file;
@@ -295,6 +295,8 @@ int main(int argc, char **argv)
295295
("help,h", "produce help message")
296296
(",i", po::value<string>(&osd_instance), "OSD instance. Requires access to monitor/ceph.conf")
297297
("path", po::value<string>(&path), "bluestore path")
298+
("data-path", po::value<string>(&path_aux),
299+
"--path alias, ignored if the latter is present")
298300
("out-dir", po::value<string>(&out_dir), "output directory")
299301
("input-file", po::value<string>(&input_file), "import file")
300302
("dest-file", po::value<string>(&dest_file), "destination file")
@@ -309,6 +311,8 @@ int main(int argc, char **argv)
309311
("allocator", po::value<vector<string>>(&allocs_name), "allocator to inspect: 'block'/'bluefs-wal'/'bluefs-db'")
310312
("sharding", po::value<string>(&new_sharding), "new sharding to apply")
311313
("resharding-ctrl", po::value<string>(&resharding_ctrl), "gives control over resharding procedure details")
314+
("op", po::value<string>(&action_aux),
315+
"--command alias, ignored if the latter is present")
312316
;
313317
po::options_description po_positional("Positional options");
314318
po_positional.add_options()
@@ -354,6 +358,26 @@ int main(int argc, char **argv)
354358
std::cerr << e.what() << std::endl;
355359
exit(EXIT_FAILURE);
356360
}
361+
if (action != action_aux && !action.empty() && !action_aux.empty()) {
362+
std::cerr
363+
<< " Ambiguous --op and --command options, please provide a single one."
364+
<< std::endl;
365+
exit(EXIT_FAILURE);
366+
}
367+
if (action.empty()) {
368+
action.swap(action_aux);
369+
}
370+
if (!path_aux.empty()) {
371+
if (path.empty()) {
372+
path.swap(path_aux);
373+
} else if (path != path_aux) {
374+
std::cerr
375+
<< " Ambiguous --data-path and --path options, please provide a single one."
376+
<< std::endl;
377+
exit(EXIT_FAILURE);
378+
}
379+
};
380+
357381
// normalize path (remove ending '/' if any)
358382
if (path.size() > 1 && *(path.end() - 1) == '/') {
359383
path.resize(path.size() - 1);

0 commit comments

Comments
 (0)