]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rados cli: add preventing using --block-size with bench seq and rand
authorDmitry Yatsushkevich <dyatsushkevich@mirantis.com>
Mon, 30 Mar 2015 23:48:33 +0000 (16:48 -0700)
committerDmitry Yatsushkevich <dmitry.yatsushkevich@gmail.com>
Tue, 5 May 2015 21:50:01 +0000 (14:50 -0700)
Add handling of situation when '-b|--block-size' option is using with
'bench seq' or 'bench rand' which is erroneous according to the help message:
     -b op_size
            set the size of write ops for put or benchmarking

Fixes: #10163
Signed-off-by: Dmitry Yatsushkevich <dyatsushkevich@mirantis.com>
src/tools/rados/rados.cc

index 42ffa728f1316b1f35c150e4f81c9963f6d901b0..86f0abe910757e75bae5b0ec9b9f50ee058d93c6 100644 (file)
@@ -1142,6 +1142,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
   string oloc, target_oloc, nspace, target_nspace;
   int concurrent_ios = 16;
   unsigned op_size = default_op_size;
+  bool block_size_specified = false;
   bool cleanup = true;
   const char *snapname = NULL;
   snap_t snapid = CEPH_NOSNAP;
@@ -1213,6 +1214,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
     if (rados_sistrtoll(i, &op_size)) {
       return -EINVAL;
     }
+    block_size_specified = true;
   }
   i = opts.find("snap");
   if (i != opts.end()) {
@@ -2260,6 +2262,12 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
       operation = OP_RAND_READ;
     else
       usage_exit();
+    if (block_size_specified && (operation != OP_WRITE)){
+      cerr << "-b|--block_size option can be used only with `write' bench test"
+           << std::endl;
+      ret = -EINVAL;
+      goto out;
+    }
     RadosBencher bencher(g_ceph_context, rados, io_ctx);
     bencher.set_show_time(show_time);
     ret = bencher.aio_bench(operation, seconds, num_objs,