From d805875fe889b72db434d219e60590690c006a47 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 31 Aug 2016 09:57:57 -0400 Subject: [PATCH] Register keystone opts for placement sample config This adds the keystone options that you would need into the sample config generation for the placement section. It also cleans up neutron config reference to be more like the ironic, which is a ton easier to understand. Change-Id: Id31b47b4fe20cd10bef20f1efe30b04d744a0f99 --- nova/conf/neutron.py | 33 ++++++++------------------------- nova/conf/placement.py | 12 +++++++++--- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/nova/conf/neutron.py b/nova/conf/neutron.py index 1b04ffafefaf..6c444df20865 100644 --- a/nova/conf/neutron.py +++ b/nova/conf/neutron.py @@ -16,8 +16,6 @@ # License for the specific language governing permissions and limitations # under the License. -import copy - from keystoneauth1 import loading as ks_loading from oslo_config import cfg @@ -29,7 +27,6 @@ neutron_group = cfg.OptGroup( help=""" Configuration options for neutron (network connectivity as a service). """) -neutron_options = None neutron_opts = [ cfg.URIOpt('url', @@ -106,34 +103,20 @@ Related options: ALL_OPTS = (neutron_opts + metadata_proxy_opts) -def _gen_opts_from_plugins(): - opts = copy.deepcopy(neutron_options) - opts.insert(0, ks_loading.get_auth_common_conf_options()[0]) - # NOTE(dims): There are a lot of auth plugins, we just generate - # the config options for a few common ones - plugins = ['password', 'v2password', 'v3password'] - for name in plugins: - plugin = ks_loading.get_plugin_loader(name) - for plugin_option in ks_loading.get_auth_plugin_conf_options(plugin): - for option in opts: - if option.name == plugin_option.name: - break - else: - opts.append(plugin_option) - opts.sort(key=lambda x: x.name) - return opts - - def register_opts(conf): - global neutron_options conf.register_group(neutron_group) conf.register_opts(ALL_OPTS, group=neutron_group) - neutron_options = ks_loading.register_session_conf_options( - conf, NEUTRON_GROUP) + ks_loading.register_session_conf_options(conf, NEUTRON_GROUP) ks_loading.register_auth_conf_options(conf, NEUTRON_GROUP) def list_opts(): return { - neutron_group: ALL_OPTS + _gen_opts_from_plugins() + neutron_group: ( + ALL_OPTS + + ks_loading.get_session_conf_options() + + ks_loading.get_auth_common_conf_options() + + ks_loading.get_auth_plugin_conf_options('password') + + ks_loading.get_auth_plugin_conf_options('v2password') + + ks_loading.get_auth_plugin_conf_options('v3password')) } diff --git a/nova/conf/placement.py b/nova/conf/placement.py index 1bbcf0276ee6..aa7fa0259199 100644 --- a/nova/conf/placement.py +++ b/nova/conf/placement.py @@ -34,11 +34,17 @@ Possible values: def register_opts(conf): conf.register_group(placement_group) conf.register_opts(placement_opts, group=placement_group) - ks_loading.register_auth_conf_options(conf, - placement_group.name) + ks_loading.register_session_conf_options(conf, placement_group.name) + ks_loading.register_auth_conf_options(conf, placement_group.name) def list_opts(): return { - placement_group.name: placement_opts + placement_group.name: ( + placement_opts + + ks_loading.get_session_conf_options() + + ks_loading.get_auth_common_conf_options() + + ks_loading.get_auth_plugin_conf_options('password') + + ks_loading.get_auth_plugin_conf_options('v2password') + + ks_loading.get_auth_plugin_conf_options('v3password')) }