rbd-nbd: fix generic option issue

Fixes: http://tracker.ceph.com/issues/20426
Signed-off-by: Pan Liu <wanjun.lp@alibaba-inc.com>
This commit is contained in:
Pan Liu 2017-09-03 12:12:15 +08:00
parent dcd7e5bb82
commit 16f64a4c01

View File

@ -917,15 +917,27 @@ static int do_list_mapped_devices()
static int parse_args(vector<const char*>& args, std::ostream *err_msg, Config *cfg)
{
std::vector<const char*>::iterator i;
std::ostringstream err;
std::string conf_file_list;
std::string cluster;
CephInitParameters iparams = ceph_argparse_early_args(
args, CEPH_ENTITY_TYPE_CLIENT, &cluster, &conf_file_list);
md_config_t config;
config.parse_config_files(nullptr, nullptr, 0);
config.name = iparams.name;
config.cluster = cluster;
if (!conf_file_list.empty()) {
config.parse_config_files(conf_file_list.c_str(), nullptr, 0);
} else {
config.parse_config_files(nullptr, nullptr, 0);
}
config.parse_env();
config.parse_argv(args);
cfg->poolname = config.get_val<std::string>("rbd_default_pool");
std::vector<const char*>::iterator i;
std::ostringstream err;
for (i = args.begin(); i != args.end(); ) {
if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
return HELP_INFO;