]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: print useful error message if striping is specified for format 1
authorSage Weil <sage@inktank.com>
Tue, 9 Oct 2012 16:22:48 +0000 (09:22 -0700)
committerSage Weil <sage@inktank.com>
Thu, 18 Oct 2012 23:41:17 +0000 (16:41 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/rbd.cc

index 276ab69b46338c528bb5c3f3f0a34071736d9eeb..4d1d3a7ac98d6690313270f3c582c275cd15eb5d 100644 (file)
@@ -260,9 +260,15 @@ static int do_create(librbd::RBD &rbd, librados::IoCtx& io_ctx,
 {
   int r;
 
-  if (format == 1)
+  if (format == 1) {
+    // weird striping not allowed with format 1!
+    if ((stripe_unit || stripe_count) &&
+       (stripe_unit != (1ull << *order) && stripe_count != 1)) {
+      cerr << "non-default striping not allowed with format 1; use --format 2" << std::endl;
+      return -EINVAL;
+    }
     r = rbd.create(io_ctx, imgname, size, order);
-  else {
+  else {
     if (features == 0) {
       features = RBD_FEATURE_LAYERING;
     }