config options: Centralise 'utils' options

Add options from 'utils'. These options affect the entire system so
they have been included in the "nova.conf.base" file.

Change-Id: I8f454ead0f4a88aeebe3883591cef80c567170c2
Implements: bp centralize-config-options-newton
This commit is contained in:
Stephen Finucane 2016-03-29 14:56:36 +01:00
parent 363dc1846b
commit 5d5d65174e
3 changed files with 64 additions and 23 deletions

View File

@ -24,7 +24,7 @@ from oslo_config import cfg
from nova.conf import availability_zone
# from nova.conf import aws
from nova.conf import barbican
# from nova.conf import base
from nova.conf import base
from nova.conf import cells
from nova.conf import cert
# from nova.conf import cinder
@ -87,7 +87,7 @@ CONF = cfg.CONF
availability_zone.register_opts(CONF)
# aws.register_opts(CONF)
barbican.register_opts(CONF)
# base.register_opts(CONF)
base.register_opts(CONF)
cells.register_opts(CONF)
cert.register_opts(CONF)
# cinder.register_opts(CONF)

62
nova/conf/base.py Normal file
View File

@ -0,0 +1,62 @@
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
password_length = cfg.IntOpt(
'password_length',
default=12,
help='Length of generated instance admin passwords')
instance_usage_audit_period = cfg.StrOpt(
'instance_usage_audit_period',
default='month',
help='Time period to generate instance usages for. '
'Time period must be hour, day, month or year')
use_rootwrap_daemon = cfg.BoolOpt(
'use_rootwrap_daemon',
default=False,
help="Start and use a daemon that can run the commands that "
"need to be run with root privileges. This option is "
"usually enabled on nodes that run nova compute "
"processes")
rootwrap_config = cfg.StrOpt('rootwrap_config',
default="/etc/nova/rootwrap.conf",
help='Path to the rootwrap configuration file to use for '
'running commands as root')
tempdir = cfg.StrOpt(
'tempdir',
help='Explicitly specify the temporary working directory')
ALL_OPTS = [
password_length,
instance_usage_audit_period,
use_rootwrap_daemon,
rootwrap_config,
tempdir]
def register_opts(conf):
conf.register_opts(ALL_OPTS)
def list_opts():
return {'DEFAULT': ALL_OPTS}

View File

@ -74,31 +74,10 @@ monkey_patch_opts = [
],
help='List of modules/decorators to monkey patch'),
]
utils_opts = [
cfg.IntOpt('password_length',
default=12,
help='Length of generated instance admin passwords'),
cfg.StrOpt('instance_usage_audit_period',
default='month',
help='Time period to generate instance usages for. '
'Time period must be hour, day, month or year'),
cfg.BoolOpt('use_rootwrap_daemon', default=False,
help="Start and use a daemon that can run the commands that "
"need to be run with root privileges. This option is "
"usually enabled on nodes that run nova compute "
"processes"),
cfg.StrOpt('rootwrap_config',
default="/etc/nova/rootwrap.conf",
help='Path to the rootwrap configuration file to use for '
'running commands as root'),
cfg.StrOpt('tempdir',
help='Explicitly specify the temporary working directory'),
]
CONF = nova.conf.CONF
CONF.register_opts(monkey_patch_opts)
CONF.register_opts(utils_opts)
LOG = logging.getLogger(__name__)