config options: centralize section "service"

Move options from 'service' to 'conf/service.py'.

Change-Id: I621481590d93b806ea17d498a562da87207001f3
Co-Authored-By: Stephen Finucane <stephen.finucane@intel.com>
Implements: blueprint centralize-config-options-newton
This commit is contained in:
Tracy Jones
2015-12-11 08:24:18 -08:00
committed by Daniel Berrange
parent b35a1105bf
commit 185e00ee74
21 changed files with 119 additions and 117 deletions

View File

@@ -38,8 +38,6 @@ from nova.vnc import xvp_proxy
CONF = nova.conf.CONF
CONF.import_opt('enabled_apis', 'nova.service')
CONF.import_opt('enabled_ssl_apis', 'nova.service')
def main():

View File

@@ -22,19 +22,17 @@ Starts both the EC2 and OpenStack APIs in separate greenthreads.
import sys
from oslo_config import cfg
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr
import nova.conf
from nova import config
from nova import objects
from nova import service
from nova import utils
from nova import version
CONF = cfg.CONF
CONF.import_opt('enabled_apis', 'nova.service')
CONF.import_opt('enabled_ssl_apis', 'nova.service')
CONF = nova.conf.CONF
def main():

View File

@@ -32,7 +32,6 @@ from nova import version
CONF = nova.conf.CONF
CONF.import_opt('enabled_ssl_apis', 'nova.service')
def main():

View File

@@ -18,10 +18,10 @@
import sys
from oslo_config import cfg
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr
import nova.conf
from nova import config
from nova import objects
from nova import service
@@ -29,8 +29,7 @@ from nova import utils
from nova import version
CONF = cfg.CONF
CONF.import_opt('enabled_ssl_apis', 'nova.service')
CONF = nova.conf.CONF
def main():

View File

@@ -43,7 +43,6 @@ from nova import rpc
CONF = nova.conf.CONF
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('network_manager', 'nova.service')
LOG = logging.getLogger(__name__)

View File

@@ -87,8 +87,6 @@ from nova import utils
from nova import version
CONF = nova.conf.CONF
CONF.import_opt('network_manager', 'nova.service')
CONF.import_opt('service_down_time', 'nova.service')
CONF.import_opt('default_floating_pool', 'nova.network.floating_ips')
CONF.import_opt('public_interface', 'nova.network.linux_net')
CONF.import_opt('connection', 'oslo_db.options', group='database')

View File

@@ -64,6 +64,7 @@ from nova.conf import remote_debug
from nova.conf import scheduler
# from nova.conf import security
from nova.conf import serial_console
from nova.conf import service
# from nova.conf import spice
# from nova.conf import ssl
# from nova.conf import trusted_computing
@@ -124,6 +125,7 @@ rdp.register_opts(CONF)
scheduler.register_opts(CONF)
# security.register_opts(CONF)
serial_console.register_opts(CONF)
service.register_opts(CONF)
# spice.register_opts(CONF)
# ssl.register_opts(CONF)
# trusted_computing.register_opts(CONF)

103
nova/conf/service.py Normal file
View File

@@ -0,0 +1,103 @@
# Copyright 2015 OpenStack Foundation
# 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
service_opts = [
cfg.IntOpt('report_interval',
default=10,
help='Seconds between nodes reporting state to datastore'),
cfg.BoolOpt('periodic_enable',
default=True,
help='Enable periodic tasks'),
cfg.IntOpt('periodic_fuzzy_delay',
default=60,
help='Range of seconds to randomly delay when starting the'
' periodic task scheduler to reduce stampeding.'
' (Disable by setting to 0)'),
cfg.ListOpt('enabled_apis',
default=['osapi_compute', 'metadata'],
help='A list of APIs to enable by default'),
cfg.ListOpt('enabled_ssl_apis',
default=[],
help='A list of APIs with enabled SSL'),
cfg.StrOpt('osapi_compute_listen',
default="0.0.0.0",
help='The IP address on which the OpenStack API will listen.'),
cfg.IntOpt('osapi_compute_listen_port',
default=8774,
min=1,
max=65535,
help='The port on which the OpenStack API will listen.'),
cfg.IntOpt('osapi_compute_workers',
help='Number of workers for OpenStack API service. The default '
'will be the number of CPUs available.'),
cfg.StrOpt('metadata_manager',
default='nova.api.manager.MetadataManager',
help='DEPRECATED: OpenStack metadata service manager',
deprecated_for_removal=True),
cfg.StrOpt('metadata_listen',
default="0.0.0.0",
help='The IP address on which the metadata API will listen.'),
cfg.IntOpt('metadata_listen_port',
default=8775,
min=1,
max=65535,
help='The port on which the metadata API will listen.'),
cfg.IntOpt('metadata_workers',
help='Number of workers for metadata service. The default will '
'be the number of CPUs available.'),
# NOTE(sdague): Ironic is still using this facility for their HA
# manager. Ensure they are sorted before removing this.
cfg.StrOpt('compute_manager',
default='nova.compute.manager.ComputeManager',
help='DEPRECATED: Full class name for the Manager for compute',
deprecated_for_removal=True),
cfg.StrOpt('console_manager',
default='nova.console.manager.ConsoleProxyManager',
help='DEPRECATED: Full class name for the Manager for '
'console proxy',
deprecated_for_removal=True),
cfg.StrOpt('consoleauth_manager',
default='nova.consoleauth.manager.ConsoleAuthManager',
help='DEPRECATED: Manager for console auth',
deprecated_for_removal=True),
cfg.StrOpt('cert_manager',
default='nova.cert.manager.CertManager',
help='DEPRECATED: Full class name for the Manager for cert',
deprecated_for_removal=True),
# NOTE(sdague): the network_manager has a bunch of different in
# tree classes that are still legit options. In Newton we should
# turn this into a selector.
cfg.StrOpt('network_manager',
default='nova.network.manager.VlanManager',
help='Full class name for the Manager for network'),
cfg.StrOpt('scheduler_manager',
default='nova.scheduler.manager.SchedulerManager',
help='DEPRECATED: Full class name for the Manager for '
'scheduler',
deprecated_for_removal=True),
cfg.IntOpt('service_down_time',
default=60,
help='Maximum time since last check-in for up service'),
]
def register_opts(conf):
conf.register_opts(service_opts)
def list_opts():
return {'DEFAULT': service_opts}

View File

@@ -39,7 +39,6 @@ import nova.notifications
import nova.objects.network
import nova.paths
import nova.quota
import nova.service
import nova.servicegroup.api
import nova.spice
import nova.utils
@@ -71,7 +70,6 @@ def list_opts():
nova.objects.network.network_opts,
nova.paths.path_opts,
nova.quota.quota_opts,
nova.service.service_opts,
nova.utils.monkey_patch_opts,
nova.utils.utils_opts,
nova.volume._volume_opts,

View File

@@ -22,7 +22,6 @@ import random
import sys
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_service import service
@@ -30,6 +29,7 @@ from oslo_utils import importutils
from nova import baserpc
from nova import conductor
import nova.conf
from nova import context
from nova import debugger
from nova import exception
@@ -45,87 +45,7 @@ from nova import wsgi
LOG = logging.getLogger(__name__)
service_opts = [
cfg.IntOpt('report_interval',
default=10,
help='Seconds between nodes reporting state to datastore'),
cfg.BoolOpt('periodic_enable',
default=True,
help='Enable periodic tasks'),
cfg.IntOpt('periodic_fuzzy_delay',
default=60,
help='Range of seconds to randomly delay when starting the'
' periodic task scheduler to reduce stampeding.'
' (Disable by setting to 0)'),
cfg.ListOpt('enabled_apis',
default=['osapi_compute', 'metadata'],
help='A list of APIs to enable by default'),
cfg.ListOpt('enabled_ssl_apis',
default=[],
help='A list of APIs with enabled SSL'),
cfg.StrOpt('osapi_compute_listen',
default="0.0.0.0",
help='The IP address on which the OpenStack API will listen.'),
cfg.IntOpt('osapi_compute_listen_port',
default=8774,
min=1,
max=65535,
help='The port on which the OpenStack API will listen.'),
cfg.IntOpt('osapi_compute_workers',
help='Number of workers for OpenStack API service. The default '
'will be the number of CPUs available.'),
cfg.StrOpt('metadata_manager',
default='nova.api.manager.MetadataManager',
help='DEPRECATED: OpenStack metadata service manager',
deprecated_for_removal=True),
cfg.StrOpt('metadata_listen',
default="0.0.0.0",
help='The IP address on which the metadata API will listen.'),
cfg.IntOpt('metadata_listen_port',
default=8775,
min=1,
max=65535,
help='The port on which the metadata API will listen.'),
cfg.IntOpt('metadata_workers',
help='Number of workers for metadata service. The default will '
'be the number of CPUs available.'),
# NOTE(sdague): Ironic is still using this facility for their HA
# manager. Ensure they are sorted before removing this.
cfg.StrOpt('compute_manager',
default='nova.compute.manager.ComputeManager',
help='DEPRECATED: Full class name for the Manager for compute',
deprecated_for_removal=True),
cfg.StrOpt('console_manager',
default='nova.console.manager.ConsoleProxyManager',
help='DEPRECATED: Full class name for the Manager for '
'console proxy',
deprecated_for_removal=True),
cfg.StrOpt('consoleauth_manager',
default='nova.consoleauth.manager.ConsoleAuthManager',
help='DEPRECATED: Manager for console auth',
deprecated_for_removal=True),
cfg.StrOpt('cert_manager',
default='nova.cert.manager.CertManager',
help='DEPRECATED: Full class name for the Manager for cert',
deprecated_for_removal=True),
# NOTE(sdague): the network_manager has a bunch of different in
# tree classes that are still legit options. In Newton we should
# turn this into a selector.
cfg.StrOpt('network_manager',
default='nova.network.manager.VlanManager',
help='Full class name for the Manager for network'),
cfg.StrOpt('scheduler_manager',
default='nova.scheduler.manager.SchedulerManager',
help='DEPRECATED: Full class name for the Manager for '
'scheduler',
deprecated_for_removal=True),
cfg.IntOpt('service_down_time',
default=60,
help='Maximum time since last check-in for up service'),
]
CONF = cfg.CONF
CONF.register_opts(service_opts)
CONF = nova.conf.CONF
CONF.import_opt('host', 'nova.netconf')

View File

@@ -13,19 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_utils import timeutils
import six
import nova.conf
from nova.i18n import _, _LI, _LW, _LE
from nova.servicegroup import api
from nova.servicegroup.drivers import base
CONF = cfg.CONF
CONF.import_opt('service_down_time', 'nova.service')
CONF = nova.conf.CONF
LOG = logging.getLogger(__name__)

View File

@@ -17,18 +17,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import timeutils
from nova import cache_utils
import nova.conf
from nova.i18n import _, _LI, _LW
from nova.servicegroup import api
from nova.servicegroup.drivers import base
CONF = cfg.CONF
CONF.import_opt('service_down_time', 'nova.service')
CONF = nova.conf.CONF
LOG = logging.getLogger(__name__)

View File

@@ -99,7 +99,6 @@ from nova.volume import cinder
QUOTAS = quota.QUOTAS
LOG = logging.getLogger(__name__)
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('live_migration_retry_count', 'nova.compute.manager')

View File

@@ -21,7 +21,6 @@ from eventlet import event as eventlet_event
import mock
from mox3 import mox
import netaddr
from oslo_config import cfg
import oslo_messaging as messaging
from oslo_serialization import jsonutils
from oslo_utils import importutils
@@ -37,6 +36,7 @@ from nova.compute import task_states
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova.conductor import api as conductor_api
import nova.conf
from nova import context
from nova import db
from nova import exception
@@ -64,8 +64,7 @@ from nova.virt import fake as fake_driver
from nova.virt import hardware
CONF = cfg.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF = nova.conf.CONF
class ComputeManagerUnitTestCase(test.NoDBTestCase):

View File

@@ -51,7 +51,6 @@ from nova.tests import uuidsentinel as uuids
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
def create_instance(context, user_id='fake', project_id='fake', params=None):

View File

@@ -25,7 +25,6 @@ from nova.tests.unit.virt.xenapi import stubs
from nova.virt.xenapi import vm_utils
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
class ComputeXenTestCase(stubs.XenAPITestBaseNoDB):

View File

@@ -25,7 +25,6 @@ from nova.virt import fake
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
class BaseTestCase(test.TestCase):

View File

@@ -17,10 +17,10 @@
"""Tests For Console proxy."""
import mock
from oslo_config import cfg
from oslo_utils import importutils
from nova.compute import rpcapi as compute_rpcapi
import nova.conf
from nova.console import api as console_api
from nova import context
from nova import db
@@ -28,8 +28,7 @@ from nova import exception
from nova import objects
from nova import test
CONF = cfg.CONF
CONF.import_opt('console_manager', 'nova.service')
CONF = nova.conf.CONF
CONF.import_opt('console_driver', 'nova.console.manager')

View File

@@ -108,7 +108,6 @@ libvirt_guest.libvirt = fakelibvirt
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('my_ip', 'nova.netconf')
CONF.import_opt('instances_path', 'nova.compute.manager')

View File

@@ -39,7 +39,6 @@ from nova.virt.libvirt import imagecache
from nova.virt.libvirt import utils as libvirt_utils
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('host', 'nova.netconf')

View File

@@ -74,8 +74,6 @@ from nova.virt.xenapi import volume_utils
LOG = logging.getLogger(__name__)
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('network_manager', 'nova.service')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('login_timeout', 'nova.virt.xenapi.client.session',
group="xenserver")