From 90892fd94664331b9851eaf28ab37269f118c976 Mon Sep 17 00:00:00 2001 From: songweibin Date: Thu, 22 Feb 2018 14:20:08 +0800 Subject: [PATCH] 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 --- src/tools/rbd/action/Nbd.cc | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) 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()); } -- 2.47.3