Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mimic: tools: ceph-objectstore-tool: Allow target level as first positional … #24116

Merged
merged 1 commit into from Oct 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/tools/ceph_objectstore_tool.cc
Expand Up @@ -3124,8 +3124,7 @@ int main(int argc, char **argv)
positional.add_options()
("object", po::value<string>(&object), "'' for pgmeta_oid, object name or ghobject in json")
("objcmd", po::value<string>(&objcmd), "command [(get|set)-bytes, (get|set|rm)-(attr|omap), (get|set)-omaphdr, list-attrs, list-omap, remove]")
("arg1", po::value<string>(&arg1), "arg1 based on cmd, "
"for apply-layout-settings: target hash level split to")
("arg1", po::value<string>(&arg1), "arg1 based on cmd")
("arg2", po::value<string>(&arg2), "arg2 based on cmd")
;

Expand Down Expand Up @@ -3237,7 +3236,7 @@ int main(int argc, char **argv)
usage(desc);
return 1;
}
if (op != "list" &&
if (op != "list" && op != "apply-layout-settings" &&
vm.count("op") && vm.count("object")) {
cerr << "Can't specify both --op and object command syntax" << std::endl;
usage(desc);
Expand All @@ -3249,7 +3248,7 @@ int main(int argc, char **argv)
usage(desc);
return 1;
}
if (op != "list" && vm.count("object") && !vm.count("objcmd")) {
if (op != "list" && op != "apply-layout-settings" && vm.count("object") && !vm.count("objcmd")) {
cerr << "Invalid syntax, missing command" << std::endl;
usage(desc);
return 1;
Expand Down Expand Up @@ -3519,7 +3518,14 @@ int main(int argc, char **argv)

if (op == "apply-layout-settings") {
int target_level = 0;
if (vm.count("arg1") && isdigit(arg1[0])) {
// Single positional argument with apply-layout-settings
// for target_level.
if (vm.count("object") && isdigit(object[0])) {
target_level = atoi(object.c_str());
// This requires --arg1 to be specified since
// this is the third positional argument and normally
// used with object operations.
} else if (vm.count("arg1") && isdigit(arg1[0])) {
target_level = atoi(arg1.c_str());
}
ret = apply_layout_settings(fs, superblock, pool, pgid, dry_run, target_level);
Expand Down