]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd,mds: return error if injectargs fails 8840/head
authorKefu Chai <tchaikov@gmail.com>
Thu, 5 May 2016 05:49:43 +0000 (13:49 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 17 May 2016 05:41:50 +0000 (13:41 +0800)
* test_osd_bench: the injectargs call actually fails due to the spaces
  at the beginning. so remove the spaces in args before sending it to
  injectargs
* update/add some injectargs tests accordingly

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
qa/workunits/cephtool/test.sh
src/mds/MDSDaemon.cc
src/osd/OSD.cc

index 1e18b78111abfb1365aaa900a1dd86136c9fe1d2..a533730220ceff3894e0b071d92e6a7b3b8cb46a 100755 (executable)
@@ -196,11 +196,14 @@ function test_mon_injectargs()
   check_response "osd_enable_op_tracker = 'true'"
   ceph tell osd.0 injectargs -- '--osd_enable_op_tracker --osd_op_history_duration 600' >& $TMPFILE || return 1
   check_response "osd_enable_op_tracker = 'true' osd_op_history_duration = '600'"
-  ceph tell osd.0 injectargs -- '--osd_op_history_duration' >& $TMPFILE || return 1
-  check_response "Option --osd_op_history_duration requires an argument"
+  expect_failure $TMPDIR "Option --osd_op_history_duration requires an argument" \
+                 ceph tell osd.0 injectargs -- '--osd_op_history_duration'
 
   ceph tell osd.0 injectargs -- '--mon-lease 6' >& $TMPFILE || return 1
   check_response "mon_lease = '6' (unchangeable)"
+
+  # osd-scrub-auto-repair-num-errors is an OPT_U32, so -1 is not a valid setting
+  expect_false ceph tell osd.0 injectargs --osd-scrub-auto-repair-num-errors -1
 }
 
 function test_mon_injectargs_SI()
@@ -228,6 +231,7 @@ function test_mon_injectargs_SI()
   ceph tell mon.a injectargs '--mon_pg_warn_min_objects 1G'
   expect_config_value "mon.a" "mon_pg_warn_min_objects" 1073741824
   expect_false ceph tell mon.a injectargs '--mon_pg_warn_min_objects 10F'
+  expect_false ceph tell mon.a injectargs '--mon_globalid_prealloc -1'
   $SUDO ceph daemon mon.a config set mon_pg_warn_min_objects $initial_value
 }
 
@@ -734,6 +738,7 @@ function test_mds_tell()
   for mds_gid in $old_mds_gids ; do
       ceph tell mds.$mds_gid injectargs "--debug-mds 20"
   done
+  expect_false ceph tell mds.a injectargs mds_max_file_recover -1
 
   # Test respawn by rank
   ceph tell mds.0 respawn
@@ -1668,11 +1673,12 @@ function test_osd_bench()
   # max block size: 2097152   # 2MB
   # duration: 10              # 10 seconds
 
-  ceph tell osd.0 injectargs "\
+  local args="\
     --osd-bench-duration 10 \
     --osd-bench-max-block-size 2097152 \
     --osd-bench-large-size-max-throughput 10485760 \
     --osd-bench-small-size-max-iops 10"
+  ceph tell osd.0 injectargs ${args## }
 
   # anything with a bs larger than 2097152  must fail
   expect_false ceph tell osd.0 bench 1 2097153
index e7d9fe51b13fdf3a4fe6544168ada431713f44a7..8b61afa85ee56755c755fa36338dae1ae919f19d 100644 (file)
@@ -769,7 +769,7 @@ int MDSDaemon::_handle_command(
     string args = argsvec.front();
     for (vector<string>::iterator a = ++argsvec.begin(); a != argsvec.end(); ++a)
       args += " " + *a;
-    cct->_conf->injectargs(args, &ss);
+    r = cct->_conf->injectargs(args, &ss);
   } else if (prefix == "exit") {
     // We will send response before executing
     ss << "Exiting...";
index 973f3eb2cd9013e8b67ca456c3ef9bb16f57c56e..a82ab0037d5b47063939dc792427723a6166c56c 100644 (file)
@@ -5462,7 +5462,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
     for (vector<string>::iterator a = ++argsvec.begin(); a != argsvec.end(); ++a)
       args += " " + *a;
     osd_lock.Unlock();
-    cct->_conf->injectargs(args, &ss);
+    r = cct->_conf->injectargs(args, &ss);
     osd_lock.Lock();
   }
   else if (prefix == "cluster_log") {