]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: create command throws inappropriate error messages
authorRajesh Nambiar <rajesh.n@msystechnologies.com>
Wed, 8 Apr 2015 06:31:48 +0000 (23:31 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Wed, 8 Apr 2015 06:31:48 +0000 (23:31 -0700)
Fixes: #2862
Changes related to rbd file

Changes to rbd.cc
-----------------

Change 1: line# 2744 to 2747

 If the option is --order then do the check of its value if its less
 than 12 or greaterthan 25 then throw error. Correct value of --order
 is 12 to 25.

Change 2: Removal of validation from line# 3205 to 3209

  Since the check for correct value of --order is done before hence the
  check here is not needed.

Signed-off-by: Rajesh Nambiar <rajesh.n@msystechnologies.com>
src/rbd.cc

index 50a044aa18388878e59beb3f008a3dc5a746c00e..37be146d67a5df23e44a86c477cf108fc52d116b 100644 (file)
@@ -2799,6 +2799,10 @@ int main(int argc, const char **argv)
        cerr << "rbd: " << err.str() << std::endl;
        return EXIT_FAILURE;
       }
+      if ((order <= 0) || (order < 12) || (order > 25)) {
+       cerr << "rbd: order must be between 12 (4 KB) and 25 (32 MB)" << std::endl;
+       return EXIT_FAILURE;
+      }
     } else if (ceph_argparse_witharg(args, i, &bench_io_size, &err, "--io-size", (char*)NULL)) {
       if (!err.str().empty()) {
        cerr << "rbd: " << err.str() << std::endl;
@@ -3308,11 +3312,6 @@ if (!set_conf_param(v, p1, p2, p3)) { \
   }
 
   if (opt_cmd == OPT_CREATE || opt_cmd == OPT_CLONE || opt_cmd == OPT_IMPORT) {
-    if (order && (order < 12 || order > 25)) {
-      cerr << "rbd: order must be between 12 (4 KB) and 25 (32 MB)"
-          << std::endl;
-      return EINVAL;
-    }
     if ((stripe_unit && !stripe_count) || (!stripe_unit && stripe_count)) {
       cerr << "must specify both (or neither) of stripe-unit and stripe-count"
           << std::endl;