]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: recognize exclusive map option
authorIlya Dryomov <idryomov@gmail.com>
Sun, 23 Apr 2017 19:49:37 +0000 (21:49 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 25 Apr 2017 18:15:41 +0000 (20:15 +0200)
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
doc/man/8/rbd.rst
src/test/cli/rbd/help.t
src/tools/rbd/action/Kernel.cc

index a3471ffc10c9b87b401e0e0dc30e03cfab0ada3a..d821c3de4866bb4fc6defdd793faf3355fe55298 100644 (file)
@@ -484,6 +484,8 @@ Per mapping (block device) `rbd map` options:
 * lock_on_read - Acquire exclusive lock on reads, in addition to writes and
   discards (since 4.9).
 
+* exclusive - Disable automatic exclusive lock transitions (since 4.12).
+
 `rbd unmap` options:
 
 * force - Force the unmapping of a block device that is open (since 4.9).  The
index 8d4d5f59c3c4308ef5482d04a74ed15cf43fc709..e8bbb2d1353a003e82a13b2579260a02aa7e6646 100644 (file)
   
   rbd help map
   usage: rbd map [--pool <pool>] [--image <image>] [--snap <snap>] 
-                 [--options <options>] [--read-only] 
+                 [--options <options>] [--read-only] [--exclusive] 
                  <image-or-snap-spec> 
   
   Map image to a block device using the kernel.
     --snap arg            snapshot name
     -o [ --options ] arg  map options
     --read-only           map read-only
+    --exclusive           disable automatic exclusive lock transitions
   
   rbd help merge-diff
   usage: rbd merge-diff [--path <path>] [--no-progress] 
index 3db901d3da75bdc8985e293a6fb04f47f5d175f8..336dd597d86b01c90f3bd9239b3ec0b6cb76b7ad 100644 (file)
@@ -133,6 +133,8 @@ static int parse_map_options(char *options)
         return -EINVAL;
     } else if (!strcmp(this_char, "lock_on_read")) {
       put_map_option("lock_on_read", this_char);
+    } else if (!strcmp(this_char, "exclusive")) {
+      put_map_option("exclusive", this_char);
     } else {
       std::cerr << "rbd: unknown map option '" << this_char << "'" << std::endl;
       return -EINVAL;
@@ -385,7 +387,8 @@ void get_map_arguments(po::options_description *positional,
                                      at::ARGUMENT_MODIFIER_NONE);
   options->add_options()
     ("options,o", po::value<std::string>(), "map options")
-    ("read-only", po::bool_switch(), "map read-only");
+    ("read-only", po::bool_switch(), "map read-only")
+    ("exclusive", po::bool_switch(), "disable automatic exclusive lock transitions");
 }
 
 int execute_map(const po::variables_map &vm) {
@@ -404,6 +407,9 @@ int execute_map(const po::variables_map &vm) {
   if (vm["read-only"].as<bool>()) {
     put_map_option("rw", "ro");
   }
+  if (vm["exclusive"].as<bool>()) {
+    put_map_option("exclusive", "exclusive");
+  }
 
   // parse default options first so they can be overwritten by cli options
   char *default_map_options = strdup(g_conf->rbd_default_map_options.c_str());
@@ -503,7 +509,7 @@ int execute_unmap(const po::variables_map &vm) {
   return 0;
 }
 
-Shell::SwitchArguments switched_arguments({"read-only"});
+Shell::SwitchArguments switched_arguments({"read-only", "exclusive"});
 Shell::Action action_show(
   {"showmapped"}, {}, "Show the rbd images mapped by the kernel.", "",
   &get_show_arguments, &execute_show);