diff options
author | Sage Weil <sage@redhat.com> | 2018-03-08 23:36:57 +0100 |
---|---|---|
committer | Sage Weil <sage@redhat.com> | 2018-03-15 21:51:55 +0100 |
commit | 6972273d53dc2fcbe9c65d70a4e0f2af6270194e (patch) | |
tree | 418ef0c29a4d89bf91c31ad05cd2221e5fee1441 /src/test/objectstore_bench.cc | |
parent | Merge pull request #20769 from oritwas/wip-rgw-20448 (diff) | |
download | ceph-6972273d53dc2fcbe9c65d70a4e0f2af6270194e.tar.xz ceph-6972273d53dc2fcbe9c65d70a4e0f2af6270194e.zip |
global: output usage on -h, --help, or no args before contacting mons
- when there are no arguments, print a short invitation to stderr to
use -h or --help and exit with an error.
- if we get -h or --help, print usage to stdout, and exit with success.
- do the above *before* making any contact with the cluster. we should
not fail to explain usage because the mons are down.
- if there is some other error with the arguments, print an error message,
but do not spam the user with usage. Try to use cerr instead of derr.
Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src/test/objectstore_bench.cc')
-rw-r--r-- | src/test/objectstore_bench.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/objectstore_bench.cc b/src/test/objectstore_bench.cc index 406dce3a75e..7b67cba724b 100644 --- a/src/test/objectstore_bench.cc +++ b/src/test/objectstore_bench.cc @@ -20,7 +20,7 @@ static void usage() { - derr << "usage: ceph_objectstore_bench [flags]\n" + cout << "usage: ceph_objectstore_bench [flags]\n" " --size\n" " total size in bytes\n" " --block-size\n" @@ -30,7 +30,7 @@ static void usage() " --threads\n" " number of threads to carry out this workload\n" " --multi-object\n" - " have each thread write to a separate object\n" << dendl; + " have each thread write to a separate object\n" << std::endl; generic_server_usage(); } @@ -167,13 +167,13 @@ int main(int argc, const char *argv[]) std::string err; if (!cfg.size.parse(val, &err)) { derr << "error parsing size: " << err << dendl; - usage(); + exit(1); } } else if (ceph_argparse_witharg(args, i, &val, "--block-size", (char*)nullptr)) { std::string err; if (!cfg.block_size.parse(val, &err)) { derr << "error parsing block-size: " << err << dendl; - usage(); + exit(1); } } else if (ceph_argparse_witharg(args, i, &val, "--repeats", (char*)nullptr)) { cfg.repeats = atoi(val.c_str()); @@ -183,7 +183,7 @@ int main(int argc, const char *argv[]) cfg.multi_object = true; } else { derr << "Error: can't understand argument: " << *i << "\n" << dendl; - usage(); + exit(1); } } |