]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cli: CEPH_ARGS must be before injectargs 2733/head
authorLoic Dachary <loic-201408@dachary.org>
Thu, 16 Oct 2014 15:39:15 +0000 (08:39 -0700)
committerLoic Dachary <loic-201408@dachary.org>
Tue, 21 Oct 2014 06:03:11 +0000 (23:03 -0700)
It is incorrect to append the content of CEPH_ARGS to the argument list
when running injectargs. For instance if

  CEPH_ARGS='--log-file the.log' \
    ./ceph tell osd.0 injectargs --no-osd_debug_op_order

translates into

    ./ceph tell osd.0 injectargs --no-osd_debug_op_order \
                                 --log-file the.log

it ends up changing the log file of osd.0 which is probably unintended.
Instead CEPH_ARGS is inserted before injectargs and it translates into:

    ./ceph tell osd.0 --log-file the.log \
                      injectargs --no-osd_debug_op_order

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
qa/workunits/cephtool/test.sh
src/ceph.in

index 9da3603d764d50bdda47746993059ccb550234b3..d06c45a7ede82e8bea8546011d1412bd17da2a79 100755 (executable)
@@ -157,6 +157,9 @@ function expect_config_value()
 
 function test_mon_injectargs()
 {
+  CEPH_ARGS='--mon_debug_dump_location the.dump' ./ceph tell osd.0 injectargs --no-osd_debug_op_order >& $TMPFILE || return 1
+  check_response "osd_debug_op_order = 'false'"
+  ! grep "the.dump" $TMPFILE || return 1
   ceph tell osd.0 injectargs '--osd_debug_op_order --osd_debug_drop_ping_probability 444' >& $TMPFILE || return 1
   check_response "osd_debug_drop_ping_probability = '444' osd_debug_op_order = 'true'"
   ceph tell osd.0 injectargs --no-osd_debug_op_order >& $TMPFILE || return 1
index ebcfb2edce107626650e1922a3163a2f41cc1a11..4e8901b3015c817b58fbf333ab35bce6f27fb53a 100755 (executable)
@@ -526,8 +526,11 @@ def ping_monitor(cluster_handle, name):
 def main():
     ceph_args = os.environ.get('CEPH_ARGS')
     if ceph_args:
-        sys.argv.extend(ceph_args.split())
-
+        if "injectargs" in sys.argv:
+            i = sys.argv.index("injectargs")
+            sys.argv = sys.argv[:i] + ceph_args.split() + sys.argv[i:]
+        else:
+            sys.argv.extend(ceph_args.split())
     parser, parsed_args, childargs = parse_cmdargs()
 
     if parsed_args.version: