Config options: Centralize notification options
The config options of the "nova.conf" section "nova/notifications" got moved to the new central location "nova/conf/notifications.py" Change-Id: Idc6060392e62bd1eea4c68fd509f83ec986b0c25 Implements: blueprint centralize-config-options-newton
This commit is contained in:
parent
1b69a2e578
commit
169c979e0e
|
@ -58,7 +58,7 @@ from nova.conf import mks
|
|||
# from nova.conf import metrics
|
||||
from nova.conf import network
|
||||
from nova.conf import neutron
|
||||
# from nova.conf import notification
|
||||
from nova.conf import notifications
|
||||
from nova.conf import novnc
|
||||
# from nova.conf import osapi_v21
|
||||
from nova.conf import pci
|
||||
|
@ -124,7 +124,7 @@ keymgr.register_opts(CONF)
|
|||
# metrics.register_opts(CONF)
|
||||
network.register_opts(CONF)
|
||||
neutron.register_opts(CONF)
|
||||
# notification.register_opts(CONF)
|
||||
notifications.register_opts(CONF)
|
||||
novnc.register_opts(CONF)
|
||||
# osapi_v21.register_opts(CONF)
|
||||
pci.register_opts(CONF)
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
# Copyright (c) 2016 Intel, Inc.
|
||||
# Copyright (c) 2013 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
|
||||
|
||||
notify_on_state_change = cfg.StrOpt('notify_on_state_change',
|
||||
help='If set, send compute.instance.update notifications on instance '
|
||||
'state changes. Valid values are None for no notifications, '
|
||||
'"vm_state" for notifications on VM state changes, or '
|
||||
'"vm_and_task_state" for notifications on VM and task state '
|
||||
'changes.')
|
||||
|
||||
notify_api_faults = cfg.BoolOpt('notify_api_faults', default=False,
|
||||
help='If set, send api.fault notifications on caught exceptions '
|
||||
'in the API service.')
|
||||
|
||||
default_notification_level = cfg.StrOpt('default_notification_level',
|
||||
default='INFO',
|
||||
choices=('DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'),
|
||||
help='Default notification level for outgoing notifications')
|
||||
|
||||
default_publisher_id = cfg.StrOpt('default_publisher_id',
|
||||
help='Default publisher_id for outgoing notifications')
|
||||
|
||||
ALL_OPTS = [notify_on_state_change, notify_api_faults,
|
||||
default_notification_level,
|
||||
default_publisher_id]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(ALL_OPTS)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {'DEFAULT': ALL_OPTS}
|
|
@ -20,13 +20,13 @@ the system.
|
|||
|
||||
import datetime
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_context import context as common_context
|
||||
from oslo_log import log
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
import nova.context
|
||||
from nova import exception
|
||||
from nova.i18n import _LE
|
||||
|
@ -40,29 +40,7 @@ from nova import utils
|
|||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
notify_opts = [
|
||||
cfg.StrOpt('notify_on_state_change',
|
||||
default=None,
|
||||
choices=(None, 'vm_state', 'vm_and_task_state'),
|
||||
help='If set, send compute.instance.update notifications on '
|
||||
'instance state changes. Valid values are None for no '
|
||||
'notifications, "vm_state" for notifications on VM state '
|
||||
'changes, or "vm_and_task_state" for notifications on VM '
|
||||
'and task state changes.'),
|
||||
cfg.BoolOpt('notify_api_faults', default=False,
|
||||
help='If set, send api.fault notifications on caught exceptions '
|
||||
'in the API service.'),
|
||||
cfg.StrOpt('default_notification_level',
|
||||
default='INFO',
|
||||
choices=('DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'),
|
||||
help='Default notification level for outgoing notifications'),
|
||||
cfg.StrOpt('default_publisher_id',
|
||||
help='Default publisher_id for outgoing notifications'),
|
||||
]
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(notify_opts)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
def notify_decorator(name, fn):
|
||||
|
|
|
@ -31,7 +31,6 @@ import nova.exception
|
|||
import nova.image.download.file
|
||||
import nova.ipv6.api
|
||||
import nova.netconf
|
||||
import nova.notifications
|
||||
import nova.paths
|
||||
import nova.quota
|
||||
import nova.servicegroup.api
|
||||
|
@ -55,7 +54,6 @@ def list_opts():
|
|||
nova.db.sqlalchemy.api.db_opts,
|
||||
nova.exception.exc_log_opts,
|
||||
nova.netconf.netconf_opts,
|
||||
nova.notifications.notify_opts,
|
||||
nova.paths.path_opts,
|
||||
nova.quota.quota_opts,
|
||||
nova.volume._volume_opts,
|
||||
|
|
Loading…
Reference in New Issue