From: songweibin Date: Thu, 22 Feb 2018 06:20:08 +0000 (+0800) Subject: rbd: fix get image or snap spec in `nbd map` X-Git-Tag: v13.0.2~178^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F20529%2Fhead;p=ceph.git rbd: fix get image or snap spec in `nbd map` root@s222:/ceph-dev/build# rbd nbd map img1 rbd: 'nbd map' command is deprecated, use 'device map -t nbd' instead rbd: image name was not specified root@s222:/ceph-dev/build# rbd nbd map -p rbd --image img1 rbd: 'nbd map' command is deprecated, use 'device map -t nbd' instead rbd: image name was not specified Signed-off-by: songweibin --- diff --git a/src/tools/rbd/action/Nbd.cc b/src/tools/rbd/action/Nbd.cc index 93012cf68b2c..7889181ff122 100644 --- a/src/tools/rbd/action/Nbd.cc +++ b/src/tools/rbd/action/Nbd.cc @@ -219,32 +219,23 @@ int execute_map_deprecated(const po::variables_map &vm_deprecated, po::options_description options; options.add_options() - ("read-only", po::bool_switch(), "") - ("exclusive", po::bool_switch(), "") ("options,o", po::value>() ->default_value(std::vector(), ""), ""); - po::variables_map vm; + po::variables_map vm = vm_deprecated; po::store(po::command_line_parser({}).options(options).run(), vm); - if (vm_deprecated["read-only"].as()) { - vm.at("read-only").value() = boost::any(true); - } - if (vm_deprecated["exclusive"].as()) { - vm.at("exclusive").value() = boost::any(true); - } - std::vector opts; if (vm_deprecated.count("device")) { opts.push_back("device=" + vm_deprecated["device"].as()); } - if (vm.count("nbds_max")) { + if (vm_deprecated.count("nbds_max")) { opts.push_back("nbds_max=" + vm_deprecated["nbds_max"].as()); } - if (vm.count("max_part")) { + if (vm_deprecated.count("max_part")) { opts.push_back("max_part=" + vm_deprecated["max_part"].as()); } - if (vm.count("timeout")) { + if (vm_deprecated.count("timeout")) { opts.push_back("timeout=" + vm_deprecated["timeout"].as()); }