All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Durgin <josh.durgin@inktank.com>
To: Roald van Loon <roaldvanloon@gmail.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: New configuration / command line handling
Date: Mon, 03 Dec 2012 13:51:37 -0800	[thread overview]
Message-ID: <50BD1EE9.909@inktank.com> (raw)
In-Reply-To: <CAN04cT6XTzaqQuLyQUUWY34F9ZQ1xoLwK3uJt5+SS-Ui+MCUCg@mail.gmail.com>

On 12/03/2012 01:57 AM, Roald van Loon wrote:
> Hi list, ceph devs,
>
> I've been doing some toying with Ceph lately in my spare time and one
> of the things I'm doing is trying to refactor some of the
> configuration handling / argument parsing. I had some trouble finding
> specific runtime options and configuration settings, so I thought this
> was a good way to get to know the code somewhat better :-) Because
> boost was already used in some places, and some tests also used
> boost::program_options, I've created a new config framework based on
> this. This framework allows for more advanced configuration files in
> the future, beter command line handling, and reduces the amount of
> code in argument parsing somewhat. I also created a different observer
> system, where different parts of the code base can subscribe to
> changes in specific parameters and get notified on changes.

Awesome! We've needed better command line parsing and usage for a while.
It looks like boost::program_options does a lot of nice things there.

> To allow somewhat of a smoother transition and backwards
> compatibility, I've made the new configuration class inherit from the
> one one (md_config_t) and switched all references (like g_conf) to the
> new class. There were also some small changes in files with references
> directly to md_config_t, like pidfile_write. Global_init and
> common_init were duplicated such that it 'injects' the new
> configuration class in the ceph_context object. Most config entries
> are read directly from the md_config_t class (e.g. g_conf->pid_file),
> so it will take some more changes to allow my configuration framework
> to function properly.

This seems like a nice way to allow it to be used gradually by more
and more tools.

> Of course it's an extremely long long long way from ready, but maybe
> you're interested. Maybe you think this is not needed at all... I'd
> love to have some feedback on it either way.

It looks like you've got a good start on integrating it into the main
ceph infrastructure. Skimming over it, the general structure makes sense
to me. One part that might be a bit tricky is making the new parsing
backwards compatible with the old parsing.

1) For config options in general, '-', '_', and ' ' are all equivalent.
2) In ceph's config file format, we treat ';' as a comment in addition 
to '#'.

I'm not sure how difficult those are to handle with the built-in
boost::program_options parsers.

Converting some of the individual command line tools that use
subcommands might be a little cumbersome too, but I think they'll
be better off once it's done.

Josh

  parent reply	other threads:[~2012-12-03 21:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-03  9:57 New configuration / command line handling Roald van Loon
2012-12-03 12:04 ` Roald van Loon
2012-12-03 21:51 ` Josh Durgin [this message]
2012-12-03 22:46   ` Roald van Loon
2012-12-05  3:04     ` Josh Durgin
2012-12-13  1:15       ` Roald van Loon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50BD1EE9.909@inktank.com \
    --to=josh.durgin@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=roaldvanloon@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.