]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: Allow CLI to optionally create shared images
authorJason Dillaman <dillaman@redhat.com>
Wed, 1 Oct 2014 20:12:21 +0000 (16:12 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 13 Jan 2015 01:01:21 +0000 (20:01 -0500)
Images that are flagged as shared cannot use the RBD
object map nor RBD mirroring features.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
doc/man/8/rbd.rst
src/rbd.cc
src/test/cli/rbd/help.t

index 542454715fa2c7e6ef8d6e1e6c6d692ff5f0e07e..29eb65e6d12e2e5e1258b69890edc076b687fbf9 100644 (file)
@@ -123,6 +123,11 @@ Parameters
 
    Map the image read-only.  Equivalent to -o ro.
 
+.. option:: --image-shared
+
+   Specifies that the image will be used concurrently by multiple clients.
+   This will disable features that are dependent upon exclusive ownership
+   of the image.
 
 Commands
 ========
index 3e60aeff537915fe0219064fabc2e059305f8edb..453fea0a85d94ad0cec2d3b9dc7ed20034567324 100644 (file)
@@ -83,8 +83,9 @@ void usage()
 "                                              (-l includes snapshots/clones)\n"
 "  info <image-name>                           show information about image size,\n"
 "                                              striping, etc.\n"
-"  create [--order <bits>] --size <MB> <name>  create an empty image\n"
-"  clone [--order <bits>] <parentsnap> <clonename>\n"
+"  create [--order <bits>] [--image-shared] --size <MB> <name>\n"
+"                                              create an empty image\n"
+"  clone [--order <bits>] [--image-shared] <parentsnap> <clonename>\n"
 "                                              clone a snapshot into a COW\n"
 "                                              child image\n"
 "  children <snap-name>                        display children of snapshot\n"
@@ -94,7 +95,7 @@ void usage()
 "  rm <image-name>                             delete an image\n"
 "  export <image-name> <path>                  export image to file\n"
 "                                              \"-\" for stdout\n"
-"  import <path> <image-name>                  import image from file\n"
+"  import [--image-shared] <path> <image-name> import image from file\n"
 "                                              (dest defaults\n"
 "                                               as the filename part of file)\n"
 "                                              \"-\" for stdin\n"
@@ -146,6 +147,8 @@ void usage()
 "  --image-format <format-number>     format to use when creating an image\n"
 "                                     format 1 is the original format (default)\n"
 "                                     format 2 supports cloning\n"
+"  --image-shared                     image will be used concurrently (disables\n"
+"                                     RBD exclusive lock and dependent features)\n"
 "  --id <username>                    rados user (without 'client.'prefix) to\n"
 "                                     authenticate as\n"
 "  --keyfile <path>                   file containing secret key for use with cephx\n"
@@ -2091,7 +2094,7 @@ int main(int argc, const char **argv)
   bool format_specified = false,
     output_format_specified = false;
   int format = 1;
-  uint64_t features = RBD_FEATURE_LAYERING;
+  uint64_t features = RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK;
   const char *imgname = NULL, *snapname = NULL, *destname = NULL,
     *dest_poolname = NULL, *dest_snapname = NULL, *path = NULL,
     *devpath = NULL, *lock_cookie = NULL, *lock_client = NULL,
@@ -2193,6 +2196,8 @@ int main(int argc, const char **argv)
       progress = false;
     } else if (ceph_argparse_flag(args, i , "--allow-shrink", (char *)NULL)) {
       resize_allow_shrink = true;
+    } else if (ceph_argparse_flag(args, i, "--image-shared", (char *)NULL)) {
+      features &= ~RBD_FEATURE_EXCLUSIVE_LOCK;
     } else if (ceph_argparse_witharg(args, i, &val, "--format", (char *) NULL)) {
       long long ret = strict_strtoll(val.c_str(), 10, &parse_err);
       if (parse_err.empty()) {
index 3818ee3cac26d3bf101d62249204bb94d97a9906..3c38246b1d4acf441b5bef76276bd483d918d3eb 100644 (file)
@@ -5,8 +5,9 @@
                                                 (-l includes snapshots/clones)
     info <image-name>                           show information about image size,
                                                 striping, etc.
-    create [--order <bits>] --size <MB> <name>  create an empty image
-    clone [--order <bits>] <parentsnap> <clonename>
+    create [--order <bits>] [--image-shared] --size <MB> <name>
+                                                create an empty image
+    clone [--order <bits>] [--image-shared] <parentsnap> <clonename>
                                                 clone a snapshot into a COW
                                                 child image
     children <snap-name>                        display children of snapshot
@@ -16,7 +17,7 @@
     rm <image-name>                             delete an image
     export <image-name> <path>                  export image to file
                                                 "-" for stdout
-    import <path> <image-name>                  import image from file
+    import [--image-shared] <path> <image-name> import image from file
                                                 (dest defaults
                                                  as the filename part of file)
                                                 "-" for stdin
@@ -68,6 +69,8 @@
     --image-format <format-number>     format to use when creating an image
                                        format 1 is the original format (default)
                                        format 2 supports cloning
+    --image-shared                     image will be used concurrently (disables
+                                       RBD exclusive lock and dependent features)
     --id <username>                    rados user (without 'client.'prefix) to
                                        authenticate as
     --keyfile <path>                   file containing secret key for use with cephx