Coverage for nova/conf/database.py: 93%
14 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-24 11:16 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-24 11:16 +0000
1# Copyright 2015 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
16import copy
18from oslo_config import cfg
19from oslo_db import options as oslo_db_opts
21main_db_group = cfg.OptGroup(
22 name='database',
23 title='Main Database Options',
24 help="""
25The *Nova Database* is the primary database which is used for information
26local to a *cell*.
28This group should **not** be configured for the ``nova-compute`` service.
29""")
31api_db_group = cfg.OptGroup(
32 name='api_database',
33 title='API Database Options',
34 help="""
35The *Nova API Database* is a separate database which is used for information
36which is used across *cells*. This database is mandatory since the Mitaka
37release (13.0.0).
39This group should **not** be configured for the ``nova-compute`` service.
40""")
42# NOTE(stephenfin): We cannot simply use 'oslo_db_options.database_opts'
43# directly. If we reuse a db config option for two different groups
44# ("api_database" and "database") and deprecate or rename a config option in
45# one of these groups, "oslo.config" cannot correctly determine which one to
46# update. That's why we copy these.
47main_db_opts = copy.deepcopy(oslo_db_opts.database_opts)
48api_db_opts = copy.deepcopy(oslo_db_opts.database_opts)
50# We don't support the experimental use of database reconnect on connection
51# lost, so remove the config option that would suggest we do
52main_db_opts = [opt for opt in main_db_opts if opt.name != 'use_db_reconnect']
53api_db_opts = [opt for opt in main_db_opts if opt.name != 'use_db_reconnect']
56def register_opts(conf):
57 conf.register_opts(main_db_opts, group=main_db_group)
58 conf.register_opts(api_db_opts, group=api_db_group)
61def list_opts():
62 return {
63 main_db_group: main_db_opts,
64 api_db_group: api_db_opts,
65 }