Coverage for nova/conf/notifications.py: 88%
8 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-17 15:08 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-17 15:08 +0000
1# Copyright (c) 2016 Intel, Inc.
2# Copyright (c) 2013 OpenStack Foundation
3# All Rights Reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
17from oslo_config import cfg
19notifications_group = cfg.OptGroup(
20 name='notifications',
21 title='Notifications options',
22 help="""
23Most of the actions in Nova which manipulate the system state generate
24notifications which are posted to the messaging component (e.g. RabbitMQ) and
25can be consumed by any service outside the OpenStack. More technical details
26at https://docs.openstack.org/nova/latest/reference/notifications.html
27""")
29ALL_OPTS = [
30 cfg.StrOpt(
31 'notify_on_state_change',
32 choices=[
33 (None, 'no notifications'),
34 ('vm_state', 'Notifications are sent with VM state transition '
35 'information in the ``old_state`` and ``state`` fields. The '
36 '``old_task_state`` and ``new_task_state`` fields will be set to '
37 'the current task_state of the instance'),
38 ('vm_and_task_state', 'Notifications are sent with VM and task '
39 'state transition information'),
40 ],
41 deprecated_group='DEFAULT',
42 help="""
43If set, send compute.instance.update notifications on
44instance state changes.
46Please refer to
47https://docs.openstack.org/nova/latest/reference/notifications.html for
48additional information on notifications.
49"""),
51 cfg.StrOpt(
52 'default_level',
53 default='INFO',
54 choices=('DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'),
55 deprecated_group='DEFAULT',
56 deprecated_name='default_notification_level',
57 help="Default notification level for outgoing notifications."),
58 cfg.StrOpt(
59 'notification_format',
60 default='unversioned',
61 choices=[
62 ('both', 'Both the legacy unversioned and the new versioned '
63 'notifications are emitted'),
64 ('versioned', 'Only the new versioned notifications are emitted'),
65 ('unversioned', 'Only the legacy unversioned notifications are '
66 'emitted'),
67 ],
68 deprecated_group='DEFAULT',
69 help="""
70Specifies which notification format shall be emitted by nova.
72The versioned notification interface are in feature parity with the legacy
73interface and the versioned interface is actively developed so new consumers
74should used the versioned interface.
76However, the legacy interface is heavily used by ceilometer and other mature
77OpenStack components so it remains the default.
79Note that notifications can be completely disabled by setting ``driver=noop``
80in the ``[oslo_messaging_notifications]`` group.
82The list of versioned notifications is visible in
83https://docs.openstack.org/nova/latest/reference/notifications.html
84"""),
85 cfg.ListOpt(
86 'versioned_notifications_topics',
87 default=['versioned_notifications'],
88 help="""
89Specifies the topics for the versioned notifications issued by nova.
91The default value is fine for most deployments and rarely needs to be changed.
92However, if you have a third-party service that consumes versioned
93notifications, it might be worth getting a topic for that service.
94Nova will send a message containing a versioned notification payload to each
95topic queue in this list.
97The list of versioned notifications is visible in
98https://docs.openstack.org/nova/latest/reference/notifications.html
99"""),
100 cfg.BoolOpt(
101 'bdms_in_notifications',
102 default=False,
103 help="""
104If enabled, include block device information in the versioned notification
105payload. Sending block device information is disabled by default as providing
106that information can incur some overhead on the system since the information
107may need to be loaded from the database.
108"""),
109 cfg.BoolOpt(
110 'include_share_mapping',
111 default=False,
112 help="""
113If enabled, include share mapping information in the versioned notification
114payload. Sending share mapping information is disabled by default as providing
115that information can incur some overhead on the system since the information
116may need to be loaded from the database.
117""")
118]
121def register_opts(conf):
122 conf.register_group(notifications_group)
123 conf.register_opts(ALL_OPTS, group=notifications_group)
126def list_opts():
127 return {notifications_group: ALL_OPTS}