Bug #9372
injectarg boolean option is discarded
100%
Description
ceph tell mon.* injectargs --perf
fails because --perf is consumed by the general purpose argument parsing. A simple workaround is to add -- so the general purpose agrument parsing ignores what is after injectargs.
ceph tell mon.* injectargs -- --perf
Here is the session log:
loic@fold:~/software/ceph/ceph/src$ ceph tell mon.* injectargs -- --perf *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *** injectargs:perf = 'true' loic@fold:~/software/ceph/ceph/src$ ceph tell mon.* injectargs -- --no-perf *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *** injectargs:perf = 'false' loic@fold:~/software/ceph/ceph/src$ ceph tell mon.* injectargs --no-perf *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *** Invalid command: saw 0 of injected_args(<string>) [<string>...], expected at least 1 injectargs <injected_args> [<injected_args>...] : inject config arguments into monitor Error EINVAL: invalid command loic@fold:~/software/ceph/ceph/src$ ceph tell mon.* injectargs '--no-perf --no-perf' *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *** injectargs:perf = 'false'
Related issues
Associated revisions
cli: do not parse injectargs arguments twice
The arguments of injectargs being valid ceph arguments, they are.
consumed when the ceph cli calls rados.conf_parse_argv(). It can be
worked around by obsuring them as in:
ceph tell osd.0 injectargs '--osd_debug_drop_ping_probability 444'
where '--osd_debug_drop_ping_probability 444' is a single argument that
does not match any known argument. The trick is that it will be
evaluated again once it reaches the OSD or the MON and translated into
the expected list of arguments. Although it is clear once explained, it
is obscure and leads to strange combinations such as:
ceph tell osd.0 injectargs '--osd_debug_op_order '
(note the extra space at the end) to set boolean parameters. A better
workaround is to add a -- marking the end of the options as in:
ceph tell osd.0 -- injectargs --osd_debug_op_order
this one is unfortunately much less documented and the user does not
usually know the exact semantic of --, let alone where it should be
placed.
The simpler solution is to split the argument list in two if
"injectargs" is found. The arguments that show after the "injectargs"
argument is removed from the list of arguments until parsing is
complete. It implements the more intuitive syntax:
ceph tell osd.0 injectargs --osd_debug_op_order
and the other forms are still valid for backward compatibility.
http://tracker.ceph.com/issues/9372 Fixes: #9372
Signed-off-by: Loic Dachary <loic-201408@dachary.org>
History
#1 Updated by Loïc Dachary over 9 years ago
- Description updated (diff)
#2 Updated by Samuel Just over 9 years ago
Looks right. Pull request?
#3 Updated by Loïc Dachary over 9 years ago
I have no pull request for this ;-) But I can try and make one if that's what you're suggesting.
#4 Updated by Loïc Dachary over 9 years ago
- Assignee set to Loïc Dachary
#5 Updated by Loïc Dachary over 9 years ago
- Status changed from 12 to Fix Under Review
- % Done changed from 0 to 80
#6 Updated by Loïc Dachary over 9 years ago
expect_false: 46: ceph injectargs mon.a '--mon_pg_warn_min_objects 10F' *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *** Traceback (most recent call last): File "./ceph", line 880, in sys.exit(main()) File "./ceph", line 823, in main sigdict, inbuf, verbose) File "./ceph", line 423, in new_style_command interactive_input = raw_input(prompt) Error: EOF EOF when reading a line expect_false: 46: return 0 test_mon_injectargs_SI: 198: ceph daemon mon.a config set mon_pg_warn_min_objects 1000
#7 Updated by Loïc Dachary over 9 years ago
- Status changed from Fix Under Review to Resolved
- % Done changed from 80 to 100
#8 Updated by Loïc Dachary over 9 years ago
There is a warkaround (using --), not sure it deserves backporting.