]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rbd: use create4() for both of format 1 and format 2. 9334/head
authorDongsheng Yang <dongsheng.yang@easystack.cn>
Mon, 11 Jul 2016 11:44:24 +0000 (07:44 -0400)
committerDongsheng Yang <dongsheng.yang@easystack.cn>
Fri, 22 Jul 2016 11:04:10 +0000 (07:04 -0400)
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
src/tools/rbd/action/Import.cc

index b69bd48e776a590a8c2dc87c69998e87d98e9eb4..a935c38b79f878f921d7f26f04c4313339101bfc 100644 (file)
@@ -131,28 +131,7 @@ static int do_import(librbd::RBD &rbd, librados::IoCtx& io_ctx,
     posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
   }
 
-  uint64_t format;
-  r = opts.get(RBD_IMAGE_OPTION_FORMAT, &format);
-  assert(r == 0);
-  if (format == 1) {
-    uint64_t stripe_unit, stripe_count;
-    r = opts.get(RBD_IMAGE_OPTION_STRIPE_UNIT, &stripe_unit);
-    assert(r == 0);
-    r = opts.get(RBD_IMAGE_OPTION_STRIPE_COUNT, &stripe_count);
-    assert(r == 0);
-
-    // weird striping not allowed with format 1!
-    if ((stripe_unit || stripe_count) &&
-        (stripe_unit != (1ull << order) && stripe_count != 1)) {
-      std::cerr << "non-default striping not allowed with format 1; "
-                << "use --image-format 2" << std::endl;
-      return -EINVAL;
-    }
-    int order_ = order;
-    r = rbd.create(io_ctx, imgname, size, &order_);
-  } else {
-    r = rbd.create4(io_ctx, imgname, size, opts);
-  }
+  r = rbd.create4(io_ctx, imgname, size, opts);
   if (r < 0) {
     std::cerr << "rbd: image creation failed" << std::endl;
     goto done;