mirror of
https://github.com/ceph/ceph
synced 2025-04-17 13:03:42 +00:00
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>
This commit is contained in:
parent
d71f70203f
commit
6972273d53
@ -75,7 +75,12 @@ int main(int argc, const char **argv, const char *envp[]) {
|
|||||||
std::vector<const char*> args;
|
std::vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
if (args.empty()) {
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
usage();
|
usage();
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string,std::string> defaults = {
|
std::map<std::string,std::string> defaults = {
|
||||||
@ -95,8 +100,6 @@ int main(int argc, const char **argv, const char *envp[]) {
|
|||||||
} else if (ceph_argparse_flag(args, i, "--localize-reads", (char*)nullptr)) {
|
} else if (ceph_argparse_flag(args, i, "--localize-reads", (char*)nullptr)) {
|
||||||
cerr << "setting CEPH_OSD_FLAG_LOCALIZE_READS" << std::endl;
|
cerr << "setting CEPH_OSD_FLAG_LOCALIZE_READS" << std::endl;
|
||||||
filer_flags |= CEPH_OSD_FLAG_LOCALIZE_READS;
|
filer_flags |= CEPH_OSD_FLAG_LOCALIZE_READS;
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)nullptr)) {
|
|
||||||
usage();
|
|
||||||
} else {
|
} else {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@ -210,8 +213,10 @@ int main(int argc, const char **argv, const char *envp[]) {
|
|||||||
|
|
||||||
MonClient *mc = new MonClient(g_ceph_context);
|
MonClient *mc = new MonClient(g_ceph_context);
|
||||||
int r = mc->build_initial_monmap();
|
int r = mc->build_initial_monmap();
|
||||||
if (r == -EINVAL)
|
if (r == -EINVAL) {
|
||||||
usage();
|
cerr << "failed to generate initial mon list" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto out_mc_start_failed;
|
goto out_mc_start_failed;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ static int parse_rank(const char *opt_name, const std::string &val)
|
|||||||
if (!err.empty()) {
|
if (!err.empty()) {
|
||||||
derr << "error parsing " << opt_name << ": failed to parse rank. "
|
derr << "error parsing " << opt_name << ": failed to parse rank. "
|
||||||
<< "It must be an int." << "\n" << dendl;
|
<< "It must be an int." << "\n" << dendl;
|
||||||
usage();
|
exit(1);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -99,6 +99,14 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args,
|
auto cct = global_init(NULL, args,
|
||||||
CEPH_ENTITY_TYPE_MDS, CODE_ENVIRONMENT_DAEMON,
|
CEPH_ENTITY_TYPE_MDS, CODE_ENVIRONMENT_DAEMON,
|
||||||
@ -110,10 +118,6 @@ int main(int argc, const char **argv)
|
|||||||
if (ceph_argparse_double_dash(args, i)) {
|
if (ceph_argparse_double_dash(args, i)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (ceph_argparse_flag(args, i, "--help", "-h", (char*)NULL)) {
|
|
||||||
// exit(1) will be called in the usage()
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
else if (ceph_argparse_witharg(args, i, &val, "--hot-standby", (char*)NULL)) {
|
else if (ceph_argparse_witharg(args, i, &val, "--hot-standby", (char*)NULL)) {
|
||||||
int r = parse_rank("hot-standby", val);
|
int r = parse_rank("hot-standby", val);
|
||||||
dout(0) << "requesting standby_replay for mds." << r << dendl;
|
dout(0) << "requesting standby_replay for mds." << r << dendl;
|
||||||
|
@ -45,6 +45,13 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
|
||||||
map<string,string> defaults = {
|
map<string,string> defaults = {
|
||||||
{ "keyring", "$mgr_data/keyring" }
|
{ "keyring", "$mgr_data/keyring" }
|
||||||
@ -53,12 +60,6 @@ int main(int argc, const char **argv)
|
|||||||
CODE_ENVIRONMENT_DAEMON, 0,
|
CODE_ENVIRONMENT_DAEMON, 0,
|
||||||
"mgr_data");
|
"mgr_data");
|
||||||
|
|
||||||
// Handle --help
|
|
||||||
if ((args.size() == 1 && (std::string(args[0]) == "--help" ||
|
|
||||||
std::string(args[0]) == "-h"))) {
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
pick_addresses(g_ceph_context, CEPH_PICK_ADDRESS_PUBLIC);
|
pick_addresses(g_ceph_context, CEPH_PICK_ADDRESS_PUBLIC);
|
||||||
|
|
||||||
global_init_daemonize(g_ceph_context);
|
global_init_daemonize(g_ceph_context);
|
||||||
|
@ -197,6 +197,14 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
// We need to specify some default values that may be overridden by the
|
// We need to specify some default values that may be overridden by the
|
||||||
// user, that are specific to the monitor. The options we are overriding
|
// user, that are specific to the monitor. The options we are overriding
|
||||||
@ -253,8 +261,6 @@ int main(int argc, const char **argv)
|
|||||||
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
||||||
if (ceph_argparse_double_dash(args, i)) {
|
if (ceph_argparse_double_dash(args, i)) {
|
||||||
break;
|
break;
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
} else if (ceph_argparse_flag(args, i, "--mkfs", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "--mkfs", (char*)NULL)) {
|
||||||
mkfs = true;
|
mkfs = true;
|
||||||
} else if (ceph_argparse_flag(args, i, "--compact", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "--compact", (char*)NULL)) {
|
||||||
@ -274,24 +280,24 @@ int main(int argc, const char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!args.empty()) {
|
if (!args.empty()) {
|
||||||
derr << "too many arguments: " << args << dendl;
|
cerr << "too many arguments: " << args << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force_sync && !yes_really) {
|
if (force_sync && !yes_really) {
|
||||||
derr << "are you SURE you want to force a sync? this will erase local data and may\n"
|
cerr << "are you SURE you want to force a sync? this will erase local data and may\n"
|
||||||
<< "break your mon cluster. pass --yes-i-really-mean-it if you do." << dendl;
|
<< "break your mon cluster. pass --yes-i-really-mean-it if you do." << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_conf->mon_data.empty()) {
|
if (g_conf->mon_data.empty()) {
|
||||||
derr << "must specify '--mon-data=foo' data path" << dendl;
|
cerr << "must specify '--mon-data=foo' data path" << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_conf->name.get_id().empty()) {
|
if (g_conf->name.get_id().empty()) {
|
||||||
derr << "must specify id (--id <id> or --name mon.<id>)" << dendl;
|
cerr << "must specify id (--id <id> or --name mon.<id>)" << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- mkfs --
|
// -- mkfs --
|
||||||
@ -664,7 +670,6 @@ int main(int argc, const char **argv)
|
|||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
derr << argv[0] << ": error generating initial monmap: "
|
derr << argv[0] << ": error generating initial monmap: "
|
||||||
<< cpp_strerror(err) << dendl;
|
<< cpp_strerror(err) << dendl;
|
||||||
usage();
|
|
||||||
prefork.exit(1);
|
prefork.exit(1);
|
||||||
}
|
}
|
||||||
if (tmpmap.contains(g_conf->name.get_id())) {
|
if (tmpmap.contains(g_conf->name.get_id())) {
|
||||||
|
@ -110,6 +110,14 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
map<string,string> defaults = {
|
map<string,string> defaults = {
|
||||||
// We want to enable leveldb's log, while allowing users to override this
|
// We want to enable leveldb's log, while allowing users to override this
|
||||||
@ -146,8 +154,6 @@ int main(int argc, const char **argv)
|
|||||||
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
||||||
if (ceph_argparse_double_dash(args, i)) {
|
if (ceph_argparse_double_dash(args, i)) {
|
||||||
break;
|
break;
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
} else if (ceph_argparse_flag(args, i, "--mkfs", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "--mkfs", (char*)NULL)) {
|
||||||
mkfs = true;
|
mkfs = true;
|
||||||
} else if (ceph_argparse_flag(args, i, "--mkjournal", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "--mkjournal", (char*)NULL)) {
|
||||||
|
@ -544,13 +544,26 @@ static void generic_usage(bool is_server)
|
|||||||
cout.flush();
|
cout.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ceph_argparse_need_usage(const std::vector<const char*>& args)
|
||||||
|
{
|
||||||
|
if (args.empty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (auto a : args) {
|
||||||
|
if (strcmp(a, "-h") == 0 ||
|
||||||
|
strcmp(a, "--help") == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void generic_server_usage()
|
void generic_server_usage()
|
||||||
{
|
{
|
||||||
generic_usage(true);
|
generic_usage(true);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void generic_client_usage()
|
void generic_client_usage()
|
||||||
{
|
{
|
||||||
generic_usage(false);
|
generic_usage(false);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ bool ceph_argparse_binary_flag(std::vector<const char*> &args,
|
|||||||
extern CephInitParameters ceph_argparse_early_args
|
extern CephInitParameters ceph_argparse_early_args
|
||||||
(std::vector<const char*>& args, uint32_t module_type,
|
(std::vector<const char*>& args, uint32_t module_type,
|
||||||
std::string *cluster, std::string *conf_file_list);
|
std::string *cluster, std::string *conf_file_list);
|
||||||
|
extern bool ceph_argparse_need_usage(const std::vector<const char*>& args);
|
||||||
extern void generic_server_usage();
|
extern void generic_server_usage();
|
||||||
extern void generic_client_usage();
|
extern void generic_client_usage();
|
||||||
|
|
||||||
|
@ -37,6 +37,13 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage_exit();
|
||||||
|
}
|
||||||
|
|
||||||
bool opt_version = false;
|
bool opt_version = false;
|
||||||
bool opt_vernum = false;
|
bool opt_vernum = false;
|
||||||
|
@ -58,6 +58,14 @@ int main(int argc, const char **argv) {
|
|||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
|
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage(argv[0]);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY, 0);
|
CODE_ENVIRONMENT_UTILITY, 0);
|
||||||
|
|
||||||
@ -90,9 +98,6 @@ int main(int argc, const char **argv) {
|
|||||||
cerr << "Unable to parse mapping string: '" << val << "'" << std::endl;
|
cerr << "Unable to parse mapping string: '" << val << "'" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage(argv[0]);
|
|
||||||
return 0;
|
|
||||||
} else if (ceph_argparse_flag(args, i, "--dump-perf-counters", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "--dump-perf-counters", (char*)NULL)) {
|
||||||
dump_perf_counters = true;
|
dump_perf_counters = true;
|
||||||
} else if (get_remainder(*i, "-")) {
|
} else if (get_remainder(*i, "-")) {
|
||||||
|
@ -2382,6 +2382,14 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, (const char **)argv, args);
|
argv_to_vec(argc, (const char **)argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY, 0);
|
CODE_ENVIRONMENT_UTILITY, 0);
|
||||||
@ -2537,9 +2545,6 @@ int main(int argc, const char **argv)
|
|||||||
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
||||||
if (ceph_argparse_double_dash(args, i)) {
|
if (ceph_argparse_double_dash(args, i)) {
|
||||||
break;
|
break;
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
ceph_abort();
|
|
||||||
} else if (ceph_argparse_witharg(args, i, &val, "-i", "--uid", (char*)NULL)) {
|
} else if (ceph_argparse_witharg(args, i, &val, "-i", "--uid", (char*)NULL)) {
|
||||||
user_id.from_str(val);
|
user_id.from_str(val);
|
||||||
} else if (ceph_argparse_witharg(args, i, &val, "--tenant", (char*)NULL)) {
|
} else if (ceph_argparse_witharg(args, i, &val, "--tenant", (char*)NULL)) {
|
||||||
@ -2580,8 +2585,7 @@ int main(int argc, const char **argv)
|
|||||||
key_type = KEY_TYPE_S3;
|
key_type = KEY_TYPE_S3;
|
||||||
} else {
|
} else {
|
||||||
cerr << "bad key type: " << key_type_str << std::endl;
|
cerr << "bad key type: " << key_type_str << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
ceph_abort();
|
|
||||||
}
|
}
|
||||||
} else if (ceph_argparse_witharg(args, i, &val, "--job-id", (char*)NULL)) {
|
} else if (ceph_argparse_witharg(args, i, &val, "--job-id", (char*)NULL)) {
|
||||||
job_id = val;
|
job_id = val;
|
||||||
@ -2695,8 +2699,7 @@ int main(int argc, const char **argv)
|
|||||||
bucket_id = val;
|
bucket_id = val;
|
||||||
if (bucket_id.empty()) {
|
if (bucket_id.empty()) {
|
||||||
cerr << "bad bucket-id" << std::endl;
|
cerr << "bad bucket-id" << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
ceph_abort();
|
|
||||||
}
|
}
|
||||||
} else if (ceph_argparse_witharg(args, i, &val, "--format", (char*)NULL)) {
|
} else if (ceph_argparse_witharg(args, i, &val, "--format", (char*)NULL)) {
|
||||||
format = val;
|
format = val;
|
||||||
@ -2870,7 +2873,7 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
if (args.empty()) {
|
if (args.empty()) {
|
||||||
usage();
|
usage();
|
||||||
ceph_abort();
|
exit(1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const char *prev_cmd = NULL;
|
const char *prev_cmd = NULL;
|
||||||
@ -2880,8 +2883,7 @@ int main(int argc, const char **argv)
|
|||||||
opt_cmd = get_cmd(*i, prev_cmd, prev_prev_cmd, &need_more);
|
opt_cmd = get_cmd(*i, prev_cmd, prev_prev_cmd, &need_more);
|
||||||
if (opt_cmd < 0) {
|
if (opt_cmd < 0) {
|
||||||
cerr << "unrecognized arg " << *i << std::endl;
|
cerr << "unrecognized arg " << *i << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
ceph_abort();
|
|
||||||
}
|
}
|
||||||
if (!need_more) {
|
if (!need_more) {
|
||||||
++i;
|
++i;
|
||||||
@ -2892,8 +2894,8 @@ int main(int argc, const char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opt_cmd == OPT_NO_CMD) {
|
if (opt_cmd == OPT_NO_CMD) {
|
||||||
usage();
|
cerr << "no command" << std::endl;
|
||||||
ceph_abort();
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* some commands may have an optional extra param */
|
/* some commands may have an optional extra param */
|
||||||
@ -2953,8 +2955,7 @@ int main(int argc, const char **argv)
|
|||||||
formatter = new JSONFormatter(pretty_format);
|
formatter = new JSONFormatter(pretty_format);
|
||||||
else {
|
else {
|
||||||
cerr << "unrecognized format: " << format << std::endl;
|
cerr << "unrecognized format: " << format << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
ceph_abort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
realm_name = g_conf->rgw_realm;
|
realm_name = g_conf->rgw_realm;
|
||||||
@ -5113,8 +5114,7 @@ int main(int argc, const char **argv)
|
|||||||
if (opt_cmd == OPT_LOG_SHOW || opt_cmd == OPT_LOG_RM) {
|
if (opt_cmd == OPT_LOG_SHOW || opt_cmd == OPT_LOG_RM) {
|
||||||
if (object.empty() && (date.empty() || bucket_name.empty() || bucket_id.empty())) {
|
if (object.empty() && (date.empty() || bucket_name.empty() || bucket_id.empty())) {
|
||||||
cerr << "specify an object or a date, bucket and bucket-id" << std::endl;
|
cerr << "specify an object or a date, bucket and bucket-id" << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
ceph_abort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string oid;
|
string oid;
|
||||||
@ -5212,8 +5212,7 @@ next:
|
|||||||
if (opt_cmd == OPT_POOL_ADD) {
|
if (opt_cmd == OPT_POOL_ADD) {
|
||||||
if (pool_name.empty()) {
|
if (pool_name.empty()) {
|
||||||
cerr << "need to specify pool to add!" << std::endl;
|
cerr << "need to specify pool to add!" << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
ceph_abort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = store->add_bucket_placement(pool);
|
int ret = store->add_bucket_placement(pool);
|
||||||
@ -5224,8 +5223,7 @@ next:
|
|||||||
if (opt_cmd == OPT_POOL_RM) {
|
if (opt_cmd == OPT_POOL_RM) {
|
||||||
if (pool_name.empty()) {
|
if (pool_name.empty()) {
|
||||||
cerr << "need to specify pool to remove!" << std::endl;
|
cerr << "need to specify pool to remove!" << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
ceph_abort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = store->remove_bucket_placement(pool);
|
int ret = store->remove_bucket_placement(pool);
|
||||||
|
@ -122,15 +122,15 @@ public:
|
|||||||
|
|
||||||
static int usage()
|
static int usage()
|
||||||
{
|
{
|
||||||
cerr << "usage: radosgw [options...]" << std::endl;
|
cout << "usage: radosgw [options...]" << std::endl;
|
||||||
cerr << "options:\n";
|
cout << "options:\n";
|
||||||
cerr << " --rgw-region=<region> region in which radosgw runs\n";
|
cout << " --rgw-region=<region> region in which radosgw runs\n";
|
||||||
cerr << " --rgw-zone=<zone> zone in which radosgw runs\n";
|
cout << " --rgw-zone=<zone> zone in which radosgw runs\n";
|
||||||
cerr << " --rgw-socket-path=<path> specify a unix domain socket path\n";
|
cout << " --rgw-socket-path=<path> specify a unix domain socket path\n";
|
||||||
cerr << " -m monaddress[:port] connect to specified monitor\n";
|
cout << " -m monaddress[:port] connect to specified monitor\n";
|
||||||
cerr << " --keyring=<path> path to radosgw keyring\n";
|
cout << " --keyring=<path> path to radosgw keyring\n";
|
||||||
cerr << " --logfile=<logfile> file to log debug output\n";
|
cout << " --logfile=<logfile> file to log debug output\n";
|
||||||
cerr << " --debug-rgw=<log-level>/<memory-level> set radosgw debug level\n";
|
cout << " --debug-rgw=<log-level>/<memory-level> set radosgw debug level\n";
|
||||||
generic_server_usage();
|
generic_server_usage();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -179,6 +179,14 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
// First, let's determine which frontends are configured.
|
// First, let's determine which frontends are configured.
|
||||||
int flags = CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS;
|
int flags = CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS;
|
||||||
@ -234,13 +242,6 @@ int main(int argc, const char **argv)
|
|||||||
CODE_ENVIRONMENT_DAEMON,
|
CODE_ENVIRONMENT_DAEMON,
|
||||||
flags, "rgw_data", false);
|
flags, "rgw_data", false);
|
||||||
|
|
||||||
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ++i) {
|
|
||||||
if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// maintain existing region root pool for new multisite objects
|
// maintain existing region root pool for new multisite objects
|
||||||
if (!g_conf->rgw_region_root_pool.empty()) {
|
if (!g_conf->rgw_region_root_pool.empty()) {
|
||||||
const char *root_pool = g_conf->rgw_region_root_pool.c_str();
|
const char *root_pool = g_conf->rgw_region_root_pool.c_str();
|
||||||
|
@ -57,6 +57,14 @@ int main(const int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
vector<const char *> args;
|
vector<const char *> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_DAEMON,
|
CODE_ENVIRONMENT_DAEMON,
|
||||||
@ -65,9 +73,6 @@ int main(const int argc, const char **argv)
|
|||||||
for (std::vector<const char *>::iterator i = args.begin(); i != args.end(); ) {
|
for (std::vector<const char *>::iterator i = args.begin(); i != args.end(); ) {
|
||||||
if (ceph_argparse_double_dash(args, i)) {
|
if (ceph_argparse_double_dash(args, i)) {
|
||||||
break;
|
break;
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,14 @@ int main(int argc, char **argv)
|
|||||||
std::string val;
|
std::string val;
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, (const char **)argv, args);
|
argv_to_vec(argc, (const char **)argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY, 0);
|
CODE_ENVIRONMENT_UTILITY, 0);
|
||||||
@ -109,7 +117,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if ((! do_encode) ||
|
if ((! do_encode) ||
|
||||||
(type == RGWToken::TOKEN_NONE)) {
|
(type == RGWToken::TOKEN_NONE)) {
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,10 +66,10 @@ static void infinite_recursion_test()
|
|||||||
|
|
||||||
static void usage()
|
static void usage()
|
||||||
{
|
{
|
||||||
cerr << "usage: TestSignalHandlers [test]" << std::endl;
|
cout << "usage: TestSignalHandlers [test]" << std::endl;
|
||||||
cerr << "--simple_segv: run simple_segv test" << std::endl;
|
cout << "--simple_segv: run simple_segv test" << std::endl;
|
||||||
cerr << "--infinite_recursion: run infinite_recursion test" << std::endl;
|
cout << "--infinite_recursion: run infinite_recursion test" << std::endl;
|
||||||
generic_client_usage(); // Will exit()
|
generic_client_usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (*test_fn_t)(void);
|
typedef void (*test_fn_t)(void);
|
||||||
@ -78,6 +78,14 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY,
|
CODE_ENVIRONMENT_UTILITY,
|
||||||
@ -88,20 +96,18 @@ int main(int argc, const char **argv)
|
|||||||
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
||||||
if (ceph_argparse_double_dash(args, i)) {
|
if (ceph_argparse_double_dash(args, i)) {
|
||||||
break;
|
break;
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
} else if (ceph_argparse_flag(args, i, "--infinite_recursion", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "--infinite_recursion", (char*)NULL)) {
|
||||||
fn = infinite_recursion_test;
|
fn = infinite_recursion_test;
|
||||||
} else if (ceph_argparse_flag(args, i, "-s", "--simple_segv", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "-s", "--simple_segv", (char*)NULL)) {
|
||||||
fn = simple_segv_test;
|
fn = simple_segv_test;
|
||||||
} else {
|
} else {
|
||||||
cerr << "Garbage at end of command line." << std::endl;
|
cerr << "unrecognized argument: " << *i << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fn) {
|
if (!fn) {
|
||||||
std::cerr << "Please select a test to run. Type -h for help." << std::endl;
|
std::cerr << "Please select a test to run. Type -h for help." << std::endl;
|
||||||
usage();
|
exit(1);
|
||||||
}
|
}
|
||||||
fn();
|
fn();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# TODO synchronize with man page
|
# TODO synchronize with man page
|
||||||
$ ceph-authtool --help
|
$ ceph-authtool --help
|
||||||
no command specified
|
|
||||||
usage: ceph-authtool keyringfile [OPTIONS]...
|
usage: ceph-authtool keyringfile [OPTIONS]...
|
||||||
where the options are:
|
where the options are:
|
||||||
-l, --list will list all keys and capabilities present in
|
-l, --list will list all keys and capabilities present in
|
||||||
|
@ -1,27 +1,5 @@
|
|||||||
$ ceph-authtool
|
$ ceph-authtool
|
||||||
ceph-authtool: must specify filename
|
ceph-authtool: -h or --help for usage
|
||||||
usage: ceph-authtool keyringfile [OPTIONS]...
|
|
||||||
where the options are:
|
|
||||||
-l, --list will list all keys and capabilities present in
|
|
||||||
the keyring
|
|
||||||
-p, --print-key will print an encoded key for the specified
|
|
||||||
entityname. This is suitable for the
|
|
||||||
'mount -o secret=..' argument
|
|
||||||
-C, --create-keyring will create a new keyring, overwriting any
|
|
||||||
existing keyringfile
|
|
||||||
-g, --gen-key will generate a new secret key for the
|
|
||||||
specified entityname
|
|
||||||
--gen-print-key will generate a new secret key without set it
|
|
||||||
to the keyringfile, prints the secret to stdout
|
|
||||||
--import-keyring FILE will import the content of a given keyring
|
|
||||||
into the keyringfile
|
|
||||||
-n NAME, --name NAME specify entityname to operate on
|
|
||||||
-u AUID, --set-uid AUID sets the auid (authenticated user id) for the
|
|
||||||
specified entityname
|
|
||||||
-a BASE64, --add-key BASE64 will add an encoded key to the keyring
|
|
||||||
--cap SUBSYSTEM CAPABILITY will set the capability for given subsystem
|
|
||||||
--caps CAPSFILE will set all of capabilities associated with a
|
|
||||||
given key, for all subsystems
|
|
||||||
[1]
|
[1]
|
||||||
|
|
||||||
# demonstrate that manpage examples fail without config
|
# demonstrate that manpage examples fail without config
|
||||||
|
@ -1,25 +1,3 @@
|
|||||||
$ ceph-authtool
|
$ ceph-authtool
|
||||||
ceph-authtool: must specify filename
|
ceph-authtool: -h or --help for usage
|
||||||
usage: ceph-authtool keyringfile [OPTIONS]...
|
|
||||||
where the options are:
|
|
||||||
-l, --list will list all keys and capabilities present in
|
|
||||||
the keyring
|
|
||||||
-p, --print-key will print an encoded key for the specified
|
|
||||||
entityname. This is suitable for the
|
|
||||||
'mount -o secret=..' argument
|
|
||||||
-C, --create-keyring will create a new keyring, overwriting any
|
|
||||||
existing keyringfile
|
|
||||||
-g, --gen-key will generate a new secret key for the
|
|
||||||
specified entityname
|
|
||||||
--gen-print-key will generate a new secret key without set it
|
|
||||||
to the keyringfile, prints the secret to stdout
|
|
||||||
--import-keyring FILE will import the content of a given keyring
|
|
||||||
into the keyringfile
|
|
||||||
-n NAME, --name NAME specify entityname to operate on
|
|
||||||
-u AUID, --set-uid AUID sets the auid (authenticated user id) for the
|
|
||||||
specified entityname
|
|
||||||
-a BASE64, --add-key BASE64 will add an encoded key to the keyring
|
|
||||||
--cap SUBSYSTEM CAPABILITY will set the capability for given subsystem
|
|
||||||
--caps CAPSFILE will set all of capabilities associated with a
|
|
||||||
given key, for all subsystems
|
|
||||||
[1]
|
[1]
|
||||||
|
@ -18,4 +18,3 @@
|
|||||||
compact-range <prefix> <start> <end>
|
compact-range <prefix> <start> <end>
|
||||||
repair
|
repair
|
||||||
|
|
||||||
[1]
|
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
$ monmaptool
|
$ monmaptool
|
||||||
monmaptool: must specify monmap filename
|
monmaptool: -h or --help for usage
|
||||||
usage: [--print] [--create [--clobber][--fsid uuid]]
|
|
||||||
[--generate] [--set-initial-members]
|
|
||||||
[--add name 1.2.3.4:567] [--rm name]
|
|
||||||
[--feature-list [plain|parseable]]
|
|
||||||
[--feature-set <value> [--optional|--persistent]]
|
|
||||||
[--feature-unset <value> [--optional|--persistent]] <mapfilename>
|
|
||||||
[1]
|
[1]
|
||||||
|
@ -1,26 +1,3 @@
|
|||||||
$ osdmaptool
|
$ osdmaptool
|
||||||
osdmaptool: must specify osdmap filename
|
osdmaptool: -h or --help for usage
|
||||||
usage: [--print] [--createsimple <numosd> [--clobber] [--pg_bits <bitsperosd>]] <mapfilename>
|
|
||||||
--export-crush <file> write osdmap's crush map to <file>
|
|
||||||
--import-crush <file> replace osdmap's crush map with <file>
|
|
||||||
--test-map-pgs [--pool <poolid>] [--pg_num <pg_num>] map all pgs
|
|
||||||
--test-map-pgs-dump [--pool <poolid>] map all pgs
|
|
||||||
--test-map-pgs-dump-all [--pool <poolid>] map all pgs to osds
|
|
||||||
--health dump health checks
|
|
||||||
--mark-up-in mark osds up and in (but do not persist)
|
|
||||||
--mark-out <osdid> mark an osd as out (but do not persist)
|
|
||||||
--with-default-pool include default pool when creating map
|
|
||||||
--clear-temp clear pg_temp and primary_temp
|
|
||||||
--test-random do random placements
|
|
||||||
--test-map-pg <pgid> map a pgid to osds
|
|
||||||
--test-map-object <objectname> [--pool <poolid>] map an object to osds
|
|
||||||
--upmap-cleanup <file> clean up pg_upmap[_items] entries, writing
|
|
||||||
commands to <file> [default: - for stdout]
|
|
||||||
--upmap <file> calculate pg upmap entries to balance pg layout
|
|
||||||
writing commands to <file> [default: - for stdout]
|
|
||||||
--upmap-max <max-count> set max upmap entries to calculate [default: 100]
|
|
||||||
--upmap-deviation <max-deviation>
|
|
||||||
max deviation from target [default: .01]
|
|
||||||
--upmap-pool <poolname> restrict upmap balancing to 1 or more pools
|
|
||||||
--upmap-save write modified OSDMap with upmap changes
|
|
||||||
[1]
|
[1]
|
||||||
|
@ -294,6 +294,5 @@
|
|||||||
--setgroup GROUP set gid to group or gid
|
--setgroup GROUP set gid to group or gid
|
||||||
--version show version and quit
|
--version show version and quit
|
||||||
|
|
||||||
[1]
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
static void usage()
|
static void usage()
|
||||||
{
|
{
|
||||||
derr << "usage: ceph_objectstore_bench [flags]\n"
|
cout << "usage: ceph_objectstore_bench [flags]\n"
|
||||||
" --size\n"
|
" --size\n"
|
||||||
" total size in bytes\n"
|
" total size in bytes\n"
|
||||||
" --block-size\n"
|
" --block-size\n"
|
||||||
@ -30,7 +30,7 @@ static void usage()
|
|||||||
" --threads\n"
|
" --threads\n"
|
||||||
" number of threads to carry out this workload\n"
|
" number of threads to carry out this workload\n"
|
||||||
" --multi-object\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();
|
generic_server_usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,13 +167,13 @@ int main(int argc, const char *argv[])
|
|||||||
std::string err;
|
std::string err;
|
||||||
if (!cfg.size.parse(val, &err)) {
|
if (!cfg.size.parse(val, &err)) {
|
||||||
derr << "error parsing size: " << err << dendl;
|
derr << "error parsing size: " << err << dendl;
|
||||||
usage();
|
exit(1);
|
||||||
}
|
}
|
||||||
} else if (ceph_argparse_witharg(args, i, &val, "--block-size", (char*)nullptr)) {
|
} else if (ceph_argparse_witharg(args, i, &val, "--block-size", (char*)nullptr)) {
|
||||||
std::string err;
|
std::string err;
|
||||||
if (!cfg.block_size.parse(val, &err)) {
|
if (!cfg.block_size.parse(val, &err)) {
|
||||||
derr << "error parsing block-size: " << err << dendl;
|
derr << "error parsing block-size: " << err << dendl;
|
||||||
usage();
|
exit(1);
|
||||||
}
|
}
|
||||||
} else if (ceph_argparse_witharg(args, i, &val, "--repeats", (char*)nullptr)) {
|
} else if (ceph_argparse_witharg(args, i, &val, "--repeats", (char*)nullptr)) {
|
||||||
cfg.repeats = atoi(val.c_str());
|
cfg.repeats = atoi(val.c_str());
|
||||||
@ -183,7 +183,7 @@ int main(int argc, const char *argv[])
|
|||||||
cfg.multi_object = true;
|
cfg.multi_object = true;
|
||||||
} else {
|
} else {
|
||||||
derr << "Error: can't understand argument: " << *i << "\n" << dendl;
|
derr << "Error: can't understand argument: " << *i << "\n" << dendl;
|
||||||
usage();
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,18 +154,19 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
std::vector<const char*> args;
|
std::vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY,
|
CODE_ENVIRONMENT_UTILITY,
|
||||||
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
|
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
|
||||||
|
|
||||||
for (auto i = args.begin(); i != args.end(); ++i) {
|
|
||||||
if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() < 2) {
|
if (args.size() < 2) {
|
||||||
usage();
|
usage();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -151,6 +151,14 @@ uint64_t do_run(ObjectStore *store, int attrsize, int numattrs,
|
|||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, (const char **)argv, args);
|
argv_to_vec(argc, (const char **)argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage(argv[0]);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(0, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(0, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY,
|
CODE_ENVIRONMENT_UTILITY,
|
||||||
|
@ -84,6 +84,14 @@ int main(int argc, const char **argv)
|
|||||||
// Argument handling
|
// Argument handling
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY,
|
CODE_ENVIRONMENT_UTILITY,
|
||||||
@ -94,7 +102,8 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
// Expect exactly one positional argument (inode number)
|
// Expect exactly one positional argument (inode number)
|
||||||
if (args.size() != 1) {
|
if (args.size() != 1) {
|
||||||
usage();
|
cerr << "missing position argument (inode number)" << std::endl;
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
char const *inode_str = args[0];
|
char const *inode_str = args[0];
|
||||||
inodeno_t inode = strtoll(inode_str, NULL, 0);
|
inodeno_t inode = strtoll(inode_str, NULL, 0);
|
||||||
|
@ -62,6 +62,15 @@ int main(int argc, const char **argv)
|
|||||||
map<string,bufferlist> caps;
|
map<string,bufferlist> caps;
|
||||||
std::string fn;
|
std::string fn;
|
||||||
|
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY,
|
CODE_ENVIRONMENT_UTILITY,
|
||||||
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
|
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
|
||||||
|
@ -292,7 +292,7 @@ class StoreTool
|
|||||||
|
|
||||||
void usage(const char *pname)
|
void usage(const char *pname)
|
||||||
{
|
{
|
||||||
std::cerr << "Usage: " << pname << " <leveldb|rocksdb|bluestore-kv> <store path> command [args...]\n"
|
std::cout << "Usage: " << pname << " <leveldb|rocksdb|bluestore-kv> <store path> command [args...]\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "Commands:\n"
|
<< "Commands:\n"
|
||||||
<< " list [prefix]\n"
|
<< " list [prefix]\n"
|
||||||
@ -317,6 +317,14 @@ int main(int argc, const char *argv[])
|
|||||||
{
|
{
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage(argv[0]);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(
|
auto cct = global_init(
|
||||||
NULL, args,
|
NULL, args,
|
||||||
|
@ -70,6 +70,11 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (vm.count("debug")) debug = true;
|
if (vm.count("debug")) debug = true;
|
||||||
|
|
||||||
|
if (vm.count("help")) {
|
||||||
|
std::cerr << desc << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(
|
auto cct = global_init(
|
||||||
NULL, ceph_options, CEPH_ENTITY_TYPE_OSD,
|
NULL, ceph_options, CEPH_ENTITY_TYPE_OSD,
|
||||||
CODE_ENVIRONMENT_UTILITY_NODOUT, 0);
|
CODE_ENVIRONMENT_UTILITY_NODOUT, 0);
|
||||||
@ -82,11 +87,6 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
g_conf->apply_changes(NULL);
|
g_conf->apply_changes(NULL);
|
||||||
|
|
||||||
if (vm.count("help")) {
|
|
||||||
std::cerr << desc << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vm.count("omap-path") == 0) {
|
if (vm.count("omap-path") == 0) {
|
||||||
std::cerr << "Required argument --omap-path" << std::endl;
|
std::cerr << "Required argument --omap-path" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -136,7 +136,7 @@ int DataScan::main(const std::vector<const char*> &args)
|
|||||||
// Parse args
|
// Parse args
|
||||||
// ==========
|
// ==========
|
||||||
if (args.size() < 1) {
|
if (args.size() < 1) {
|
||||||
usage();
|
cerr << "missing position argument" << std::endl;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +248,6 @@ int DataScan::main(const std::vector<const char*> &args)
|
|||||||
command == "cleanup") {
|
command == "cleanup") {
|
||||||
if (data_pool_name.empty()) {
|
if (data_pool_name.empty()) {
|
||||||
std::cerr << "Data pool not specified" << std::endl;
|
std::cerr << "Data pool not specified" << std::endl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ int JournalTool::main(std::vector<const char*> &argv)
|
|||||||
// Common arg parsing
|
// Common arg parsing
|
||||||
// ==================
|
// ==================
|
||||||
if (argv.empty()) {
|
if (argv.empty()) {
|
||||||
usage();
|
cerr << "missing positional argument" << std::endl;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,8 +171,7 @@ int JournalTool::main(std::vector<const char*> &argv)
|
|||||||
} else if (type == std::string("mdlog") && mode == std::string("event")) {
|
} else if (type == std::string("mdlog") && mode == std::string("event")) {
|
||||||
r = main_event(argv);
|
r = main_event(argv);
|
||||||
} else {
|
} else {
|
||||||
derr << "Bad command '" << mode << "'" << dendl;
|
cerr << "Bad command '" << mode << "'" << std::endl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,12 +216,10 @@ int JournalTool::main_journal(std::vector<const char*> &argv)
|
|||||||
force = true;
|
force = true;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Unknown argument " << argv[1] << std::endl;
|
std::cerr << "Unknown argument " << argv[1] << std::endl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
} else if (argv.size() > 2) {
|
} else if (argv.size() > 2) {
|
||||||
std::cerr << "Too many arguments!" << std::endl;
|
std::cerr << "Too many arguments!" << std::endl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return journal_reset(force);
|
return journal_reset(force);
|
||||||
@ -340,13 +337,11 @@ int JournalTool::main_event(std::vector<const char*> &argv)
|
|||||||
std::string command = *(arg++);
|
std::string command = *(arg++);
|
||||||
if (command != "get" && command != "splice" && command != "recover_dentries") {
|
if (command != "get" && command != "splice" && command != "recover_dentries") {
|
||||||
derr << "Unknown argument '" << command << "'" << dendl;
|
derr << "Unknown argument '" << command << "'" << dendl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg == argv.end()) {
|
if (arg == argv.end()) {
|
||||||
derr << "Incomplete command line" << dendl;
|
derr << "Incomplete command line" << dendl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,15 +356,14 @@ int JournalTool::main_event(std::vector<const char*> &argv)
|
|||||||
// Parse output options
|
// Parse output options
|
||||||
// ====================
|
// ====================
|
||||||
if (arg == argv.end()) {
|
if (arg == argv.end()) {
|
||||||
derr << "Missing output command" << dendl;
|
cerr << "Missing output command" << std::endl;
|
||||||
usage();
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
std::string output_style = *(arg++);
|
std::string output_style = *(arg++);
|
||||||
if (output_style != "binary" && output_style != "json" &&
|
if (output_style != "binary" && output_style != "json" &&
|
||||||
output_style != "summary" && output_style != "list") {
|
output_style != "summary" && output_style != "list") {
|
||||||
derr << "Unknown argument: '" << output_style << "'" << dendl;
|
cerr << "Unknown argument: '" << output_style << "'" << std::endl;
|
||||||
usage();
|
return -EINVAL;
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string output_path = "dump";
|
std::string output_path = "dump";
|
||||||
@ -384,8 +378,7 @@ int JournalTool::main_event(std::vector<const char*> &argv)
|
|||||||
assert(r == 0);
|
assert(r == 0);
|
||||||
other_pool = true;
|
other_pool = true;
|
||||||
} else {
|
} else {
|
||||||
derr << "Unknown argument: '" << *arg << "'" << dendl;
|
cerr << "Unknown argument: '" << *arg << "'" << std::endl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -500,8 +493,7 @@ int JournalTool::main_event(std::vector<const char*> &argv)
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
derr << "Unknown argument '" << command << "'" << dendl;
|
cerr << "Unknown argument '" << command << "'" << std::endl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ int TableTool::main(std::vector<const char*> &argv)
|
|||||||
|
|
||||||
// Require at least 3 args <rank> <mode> <arg> [args...]
|
// Require at least 3 args <rank> <mode> <arg> [args...]
|
||||||
if (argv.size() < 3) {
|
if (argv.size() < 3) {
|
||||||
usage();
|
cerr << "missing required 3 arguments" << std::endl;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,8 +368,7 @@ int TableTool::main(std::vector<const char*> &argv)
|
|||||||
jf.dump_int("result", r);
|
jf.dump_int("result", r);
|
||||||
jf.close_section();
|
jf.close_section();
|
||||||
} else {
|
} else {
|
||||||
derr << "Invalid table '" << table << "'" << dendl;
|
cerr << "Invalid table '" << table << "'" << std::endl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
} else if (mode == "show") {
|
} else if (mode == "show") {
|
||||||
@ -391,8 +390,7 @@ int TableTool::main(std::vector<const char*> &argv)
|
|||||||
}
|
}
|
||||||
jf.close_section();
|
jf.close_section();
|
||||||
} else {
|
} else {
|
||||||
derr << "Invalid table '" << table << "'" << dendl;
|
cerr << "Invalid table '" << table << "'" << std::endl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
} else if (mode == "take_inos") {
|
} else if (mode == "take_inos") {
|
||||||
@ -407,8 +405,7 @@ int TableTool::main(std::vector<const char*> &argv)
|
|||||||
return InoTableHandler(rank).take_inos(&io, ino, f);
|
return InoTableHandler(rank).take_inos(&io, ino, f);
|
||||||
}, &jf);
|
}, &jf);
|
||||||
} else {
|
} else {
|
||||||
derr << "Invalid mode '" << mode << "'" << dendl;
|
cerr << "Invalid mode '" << mode << "'" << std::endl;
|
||||||
usage();
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,18 +13,20 @@ int main(int argc, const char **argv)
|
|||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
|
||||||
|
DataScan data_scan;
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
data_scan.usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY, 0);
|
CODE_ENVIRONMENT_UTILITY, 0);
|
||||||
common_init_finish(g_ceph_context);
|
common_init_finish(g_ceph_context);
|
||||||
|
|
||||||
DataScan data_scan;
|
|
||||||
|
|
||||||
// Handle --help before calling init() so we don't depend on network.
|
|
||||||
if (args.empty() || (args.size() == 1 && (std::string(args[0]) == "--help" || std::string(args[0]) == "-h"))) {
|
|
||||||
data_scan.usage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect to mon cluster, download MDS map etc
|
// Connect to mon cluster, download MDS map etc
|
||||||
int rc = data_scan.init();
|
int rc = data_scan.init();
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
|
@ -25,18 +25,20 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
JournalTool jt;
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
jt.usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY, 0);
|
CODE_ENVIRONMENT_UTILITY, 0);
|
||||||
common_init_finish(g_ceph_context);
|
common_init_finish(g_ceph_context);
|
||||||
|
|
||||||
JournalTool jt;
|
|
||||||
|
|
||||||
// Handle --help before calling init() so we don't depend on network.
|
|
||||||
if (args.empty() || (args.size() == 1 && (std::string(args[0]) == "--help" || std::string(args[0]) == "-h"))) {
|
|
||||||
jt.usage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect to mon cluster, download MDS map etc
|
// Connect to mon cluster, download MDS map etc
|
||||||
int rc = jt.init();
|
int rc = jt.init();
|
||||||
|
@ -13,17 +13,20 @@ int main(int argc, const char **argv)
|
|||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
|
||||||
|
TableTool tt;
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
tt.usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY, 0);
|
CODE_ENVIRONMENT_UTILITY, 0);
|
||||||
common_init_finish(g_ceph_context);
|
common_init_finish(g_ceph_context);
|
||||||
|
|
||||||
TableTool tt;
|
|
||||||
|
|
||||||
// Handle --help before calling init() so we don't depend on network.
|
|
||||||
if (args.empty() || (args.size() == 1 && (std::string(args[0]) == "--help" || std::string(args[0]) == "-h"))) {
|
|
||||||
tt.usage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect to mon cluster, download MDS map etc
|
// Connect to mon cluster, download MDS map etc
|
||||||
int rc = tt.init();
|
int rc = tt.init();
|
||||||
|
@ -355,6 +355,14 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
const char *me = argv[0];
|
const char *me = argv[0];
|
||||||
std::string infn, srcfn, outfn, add_name, add_type, remove_name, reweight_name;
|
std::string infn, srcfn, outfn, add_name, add_type, remove_name, reweight_name;
|
||||||
@ -425,9 +433,6 @@ int main(int argc, const char **argv)
|
|||||||
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
||||||
if (ceph_argparse_double_dash(args, i)) {
|
if (ceph_argparse_double_dash(args, i)) {
|
||||||
break;
|
break;
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
} else if (ceph_argparse_witharg(args, i, &val, "-d", "--decompile", (char*)NULL)) {
|
} else if (ceph_argparse_witharg(args, i, &val, "-d", "--decompile", (char*)NULL)) {
|
||||||
infn = val;
|
infn = val;
|
||||||
decompile = true;
|
decompile = true;
|
||||||
|
@ -167,6 +167,14 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
const char *me = argv[0];
|
const char *me = argv[0];
|
||||||
|
|
||||||
@ -190,8 +198,6 @@ int main(int argc, const char **argv)
|
|||||||
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
||||||
if (ceph_argparse_double_dash(args, i)) {
|
if (ceph_argparse_double_dash(args, i)) {
|
||||||
break;
|
break;
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
} else if (ceph_argparse_flag(args, i, "-p", "--print", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "-p", "--print", (char*)NULL)) {
|
||||||
print = true;
|
print = true;
|
||||||
} else if (ceph_argparse_flag(args, i, "--create", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "--create", (char*)NULL)) {
|
||||||
|
@ -88,6 +88,14 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_UTILITY,
|
CODE_ENVIRONMENT_UTILITY,
|
||||||
@ -136,8 +144,6 @@ int main(int argc, const char **argv)
|
|||||||
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
|
||||||
if (ceph_argparse_double_dash(args, i)) {
|
if (ceph_argparse_double_dash(args, i)) {
|
||||||
break;
|
break;
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
} else if (ceph_argparse_flag(args, i, "-p", "--print", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "-p", "--print", (char*)NULL)) {
|
||||||
print = true;
|
print = true;
|
||||||
} else if (ceph_argparse_witharg(args, i, &val, err, "--dump", (char*)NULL)) {
|
} else if (ceph_argparse_witharg(args, i, &val, err, "--dump", (char*)NULL)) {
|
||||||
|
@ -3707,6 +3707,14 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage(cout);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
std::map < std::string, std::string > opts;
|
std::map < std::string, std::string > opts;
|
||||||
std::string val;
|
std::string val;
|
||||||
@ -3742,9 +3750,6 @@ int main(int argc, const char **argv)
|
|||||||
for (i = args.begin(); i != args.end(); ) {
|
for (i = args.begin(); i != args.end(); ) {
|
||||||
if (ceph_argparse_double_dash(args, i)) {
|
if (ceph_argparse_double_dash(args, i)) {
|
||||||
break;
|
break;
|
||||||
} else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage(cout);
|
|
||||||
exit(0);
|
|
||||||
} else if (ceph_argparse_flag(args, i, "--force-full", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "--force-full", (char*)NULL)) {
|
||||||
opts["force-full"] = "true";
|
opts["force-full"] = "true";
|
||||||
} else if (ceph_argparse_flag(args, i, "-d", "--delete-after", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "-d", "--delete-after", (char*)NULL)) {
|
||||||
|
@ -396,6 +396,14 @@ int main(int argc, const char *argv[]) {
|
|||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
|
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
std::string conf_file_list;
|
std::string conf_file_list;
|
||||||
std::string cluster;
|
std::string cluster;
|
||||||
|
@ -33,18 +33,19 @@ int main(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
std::vector<const char*> args;
|
std::vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(nullptr, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(nullptr, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_DAEMON,
|
CODE_ENVIRONMENT_DAEMON,
|
||||||
CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
|
CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
|
||||||
|
|
||||||
for (auto i = args.begin(); i != args.end(); ++i) {
|
|
||||||
if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
|
||||||
usage();
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_conf->daemonize) {
|
if (g_conf->daemonize) {
|
||||||
global_init_daemonize(g_ceph_context);
|
global_init_daemonize(g_ceph_context);
|
||||||
}
|
}
|
||||||
|
@ -665,6 +665,14 @@ static int do_map(int argc, const char *argv[], Config *cfg)
|
|||||||
|
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
|
if (args.empty()) {
|
||||||
|
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ceph_argparse_need_usage(args)) {
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||||
CODE_ENVIRONMENT_DAEMON,
|
CODE_ENVIRONMENT_DAEMON,
|
||||||
|
Loading…
Reference in New Issue
Block a user