From 9f92a6a7bb3002190e321de5575bd5f7992993c9 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 29 Mar 2016 15:10:21 +0100 Subject: [PATCH] config options: Centralise 'monkeypatch' options Add options from 'monkeypatch'. These options affect the entire system so they have been included in the "nova.conf.base" file. Change-Id: Ic85107b33e414f05984d10f2cb9b74829ab3219d Implements: bp centralize-config-options-newton --- nova/conf/base.py | 19 ++++++++++++++++++- nova/opts.py | 2 -- nova/utils.py | 15 --------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/nova/conf/base.py b/nova/conf/base.py index 1d7a4ce77a98..ed630dff8612 100644 --- a/nova/conf/base.py +++ b/nova/conf/base.py @@ -46,12 +46,29 @@ tempdir = cfg.StrOpt( 'tempdir', help='Explicitly specify the temporary working directory') +monkey_patch = cfg.BoolOpt( + 'monkey_patch', + default=False, + help='Whether to apply monkey patching') + +notify_decorator = 'nova.notifications.notify_decorator' + +monkey_patch_modules = cfg.ListOpt( + 'monkey_patch_modules', + default=[ + 'nova.compute.api:%s' % (notify_decorator) + ], + help='List of modules/decorators to monkey patch') + + ALL_OPTS = [ password_length, instance_usage_audit_period, use_rootwrap_daemon, rootwrap_config, - tempdir] + tempdir, + monkey_patch, + monkey_patch_modules] def register_opts(conf): diff --git a/nova/opts.py b/nova/opts.py index 1704635abbd8..3855e0392fca 100644 --- a/nova/opts.py +++ b/nova/opts.py @@ -38,7 +38,6 @@ import nova.paths import nova.quota import nova.servicegroup.api import nova.spice -import nova.utils import nova.volume import nova.volume.cinder @@ -63,7 +62,6 @@ def list_opts(): nova.notifications.notify_opts, nova.paths.path_opts, nova.quota.quota_opts, - nova.utils.monkey_patch_opts, nova.volume._volume_opts, )), ('cinder', nova.volume.cinder.cinder_opts), diff --git a/nova/utils.py b/nova/utils.py index 891b4d0fd51f..83e5f6e0eefb 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -42,7 +42,6 @@ import eventlet import netaddr from oslo_concurrency import lockutils from oslo_concurrency import processutils -from oslo_config import cfg from oslo_context import context as common_context from oslo_log import log as logging import oslo_messaging as messaging @@ -62,22 +61,8 @@ from nova.i18n import _, _LE, _LI, _LW import nova.network from nova import safe_utils -notify_decorator = 'nova.notifications.notify_decorator' - -monkey_patch_opts = [ - cfg.BoolOpt('monkey_patch', - default=False, - help='Whether to apply monkey patching'), - cfg.ListOpt('monkey_patch_modules', - default=[ - 'nova.compute.api:%s' % (notify_decorator) - ], - help='List of modules/decorators to monkey patch'), -] - CONF = nova.conf.CONF -CONF.register_opts(monkey_patch_opts) LOG = logging.getLogger(__name__)