]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: fix get image or snap spec in `nbd map` 20529/head
authorsongweibin <song.weibin@zte.com.cn>
Thu, 22 Feb 2018 06:20:08 +0000 (14:20 +0800)
committersongweibin <song.weibin@zte.com.cn>
Thu, 22 Feb 2018 06:32:33 +0000 (14:32 +0800)
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 <song.weibin@zte.com.cn>
src/tools/rbd/action/Nbd.cc

index 93012cf68b2cec4b73ded3cc9b39867925f12922..7889181ff122e1fbb748cc19b69b8cc7a746b782 100644 (file)
@@ -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<std::vector<std::string>>()
                   ->default_value(std::vector<std::string>(), ""), "");
 
-  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<bool>()) {
-    vm.at("read-only").value() = boost::any(true);
-  }
-  if (vm_deprecated["exclusive"].as<bool>()) {
-    vm.at("exclusive").value() = boost::any(true);
-  }
-
   std::vector<std::string> opts;
   if (vm_deprecated.count("device")) {
     opts.push_back("device=" + vm_deprecated["device"].as<std::string>());
   }
-  if (vm.count("nbds_max")) {
+  if (vm_deprecated.count("nbds_max")) {
     opts.push_back("nbds_max=" + vm_deprecated["nbds_max"].as<std::string>());
   }
-  if (vm.count("max_part")) {
+  if (vm_deprecated.count("max_part")) {
     opts.push_back("max_part=" + vm_deprecated["max_part"].as<std::string>());
   }
-  if (vm.count("timeout")) {
+  if (vm_deprecated.count("timeout")) {
     opts.push_back("timeout=" + vm_deprecated["timeout"].as<std::string>());
   }