cfg: add a global ConfigOpts instance

Registered by Mark McLoughlin

Nova and Keystone's current usage pattern with cfg is to have a global cfg.ConfigOpts instance in order to simplify access to configuration options.

This pattern was discussed on the mailing list:

  https://lists.launchpad.net/openstack/msg08329.html
  https://lists.launchpad.net/openstack/msg12418.html

and at the Folsom design summit.

The benefit of the patterns is that it is simple and concise and does not require a rather tedious exercise in passing a conf object around to all objects in the systen.

While some are somewhat concerned about the inelegance of the pattern, it has served Nova and Keystone well and is fairly common in Python projects.

One of the concerns about the pattern - issues with starting each test run with a clean state - largely is covered by #998396 and now fixed.

We should support this patttern in openstack-common by adding an instance of CommonConfigOpts named CONF in the cfg module namespace. This requires some refactoring to move a bunch of parameters from the
ConfigOpts constructor to the __call__ method.

Blueprint information

Status:
Complete
Approver:
Mark McLoughlin
Priority:
High
Drafter:
Mark McLoughlin
Direction:
Approved
Assignee:
Mark McLoughlin
Definition:
Approved
Series goal:
Accepted for folsom
Implementation:
Implemented
Milestone target:
milestone icon folsom-2
Started by
Mark McLoughlin
Completed by
Mark McLoughlin

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/cfg-global-object,n,z

Addressed by: https://review.openstack.org/7854
    cfg: move constructor args to __call__() args

Addressed by: https://review.openstack.org/7855
    cfg: add generators for iterating over all options

Addressed by: https://review.openstack.org/7856
    cfg: add a global CONF object

Addressed by: https://review.openstack.org/10598
    Add import_opt() method to ConfigOpts

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.