]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: disable allow_guessing when parsing command line options 41476/head
authorKefu Chai <kchai@redhat.com>
Fri, 21 May 2021 12:10:38 +0000 (20:10 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 21 May 2021 12:17:04 +0000 (20:17 +0800)
we pass "--id <n>" to ceph-osd for specifying the osd id, but seastar
app template also provides an option of "--idle-poll-time-us arg".
boost::program_option::command_line_parser() uses default_style when
parsing options. and default_style includes allow_guessing, which in
turn matches partial option as well, so "--id" matches with "--idle"
when we are trying to figure out which options are consumed by seastar
app template, and which are not. see
https://www.boost.org/doc/libs/1_76_0/doc/html/boost/program_options/command_line_style/style_t.html

so, in this change, stype is specified explicitly, and "allow_guessing"
is removed from the "default_style" before being passed to style(), so
that only the full option name are matched.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/main.cc

index 04f8ca7cf3363060440a5f6bf43397fa8dcafba0..78eed27ab550cd97215cbc7ca2fe3135284d9eb2 100644 (file)
@@ -37,7 +37,10 @@ auto partition_args(seastar::app_template& app, char** argv_begin, char** argv_e
   // collect all options consumed by seastar::app_template
   auto parsed = bpo::command_line_parser(std::distance(argv_begin, argv_end),
                                          argv_begin)
-    .options(app.get_options_description()).allow_unregistered().run();
+    .options(app.get_options_description())
+    .style(bpo::command_line_style::default_style &
+           ~bpo::command_line_style::allow_guessing)
+    .allow_unregistered().run();
   auto unknown_args = bpo::collect_unrecognized(parsed.options,
                                                 bpo::include_positional);
   std::vector<const char*> ceph_args, app_args;