From da494d4abb3f738315396081502fef96b0248091 Mon Sep 17 00:00:00 2001 From: Abhishek Kekane Date: Tue, 18 Sep 2018 08:55:20 +0000 Subject: [PATCH] Provision to add new config options in sample config file In Rocky we have added support for multiple backend as a EXPERIMENTAL feature. However configuration options related to multiple backend are not generated in sample config file due to some issue. We have added below 2 new config options for multiple backend. 1. enabled_backneds (added in glance) 2. default_backend (added in glance_store) Made provision to add option 2 from above to sample config file. Change-Id: I63571e4a8f85003e304f16653d60cbd38e6b6bde Partial-Bug: #1793057 --- glance_store/multi_backend.py | 15 +++++++++++++++ setup.cfg | 1 + 2 files changed, 16 insertions(+) diff --git a/glance_store/multi_backend.py b/glance_store/multi_backend.py index 9f0e507b..74505df7 100644 --- a/glance_store/multi_backend.py +++ b/glance_store/multi_backend.py @@ -98,6 +98,21 @@ Related Options: _STORE_CFG_GROUP = 'glance_store' +def _list_config_opts(): + # NOTE(abhishekk): This separated approach could list + # store options before all driver ones, which easier + # to generate sampe config file. + driver_opts = _list_driver_opts() + sample_opts = [(_STORE_CFG_GROUP, _STORE_OPTS)] + for store_entry in driver_opts: + # NOTE(abhishekk): Do not include no_conf store + if store_entry == "no_conf": + continue + sample_opts.append((store_entry, driver_opts[store_entry])) + + return sample_opts + + def _list_driver_opts(): driver_opts = {} mgr = extension.ExtensionManager('glance_store.drivers') diff --git a/setup.cfg b/setup.cfg index 226d5e7c..54a297e4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,6 +47,7 @@ glance_store.drivers = oslo.config.opts = glance.store = glance_store.backend:_list_opts + glance.multi_store = glance_store.multi_backend:_list_config_opts console_scripts = glance-rootwrap = oslo_rootwrap.cmd:main