]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-nbd: fix generic option issue
authorPan Liu <wanjun.lp@alibaba-inc.com>
Sun, 3 Sep 2017 04:12:15 +0000 (12:12 +0800)
committerPan Liu <wanjun.lp@alibaba-inc.com>
Mon, 4 Sep 2017 14:16:18 +0000 (22:16 +0800)
Fixes: http://tracker.ceph.com/issues/20426
Signed-off-by: Pan Liu <wanjun.lp@alibaba-inc.com>
src/tools/rbd_nbd/rbd-nbd.cc

index 6d432f86eb5cf3bc38ff430e8b6b30b24f4a2bdb..1ad70ce7e3897c186142e63c36f3b7afa9f957d2 100644 (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;