[openstack-dev] Cells design issue

Mark McLoughlin markmc at redhat.com
Mon Jun 17 09:14:37 UTC 2013


On Fri, 2013-06-14 at 12:41 -0700, Chris Behrens wrote:
> On Jun 13, 2013, at 11:26 PM, Mark McLoughlin <markmc at redhat.com> wrote:
> 
> > Is there any reason not to just put it in nova.conf as transport URLs?
> > 
> > (By nova.conf, I mean cfg.CONF for nova which means you could happily do
> > e.g. --config-file nova-cells.conf too)
> 
> The issue with using cfg.CONF is that we need the same config options
> for each cell.  So, I guess you'd have to dynamically create the
> config groups with cell name as the group name… and have some sort of
> global option or an option in a different config group that specifies
> the list of cells.  I think it just gets kinda nasty.  But let me know
> if I'm missing a good way to do it.  It seems like JSON is going to be
> a little more flexible. :)

I don't know whether I like it yet or not, but here's how it might look:

 [cells]
 parents = parent1
 children = child1, child2

 [cell:parent1]
 transport_url = qpid://host1/nova

 [cell:child1]
 transport_url = qpid://host2/child1_nova

 [cell:child2]
 transport_url = qpid://host2/child2_nova

Code for parsing that is:

 from oslo.config import cfg

 cells_opts = [
     cfg.ListOpt('parents', default=[]),
     cfg.ListOpt('children', default=[]),
 ]

 cell_opts = [
     cfg.StrOpt('api_url'),
     cfg.StrOpt('transport_url'),
     cfg.FloatOpt('weight_offset', default=0.0),
     cfg.FloatOpt('weight_scale', default=1.0),
 ]

 conf = cfg.CONF
 conf(['--config-file=cells.conf'])
 conf.register_opts(cells_opts, group='cells')

 def get_cell(conf, name):
     group_name = 'cell:' + name
     conf.register_opts(cell_opts, group=group_name)
     return conf[group_name]

 for cell in conf.cells.parents + conf.cells.children:
     print cell, get_cell(conf, cell).items()


Ok ... I think I do like it :)

Cheers,
Mark.




More information about the OpenStack-dev mailing list