]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-nbd: fix generic option issue 17557/head
authorPan Liu <wanjun.lp@alibaba-inc.com>
Sun, 3 Sep 2017 04:12:15 +0000 (12:12 +0800)
committerAbhishek Lekshmanan <abhishek@suse.com>
Thu, 7 Sep 2017 12:55:33 +0000 (14:55 +0200)
Fixes: http://tracker.ceph.com/issues/20426
Signed-off-by: Pan Liu <wanjun.lp@alibaba-inc.com>
(cherry picked from commit 16f64a4c01068603736af476f640268d0baa338d)

src/tools/rbd_nbd/rbd-nbd.cc

index e892fbd5ac0fa5a3891ff09a72cc2d946d8f9b75..b566489071c95c35ce398b4e1e176a16e3d12e5b 100644 (file)
@@ -924,15 +924,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.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;