Coverage for nova/conf/paths.py: 91%
11 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 2010 United States Government as represented by the
2# Administrator of the National Aeronautics and Space Administration.
3# All Rights Reserved.
4# Copyright 2012 Red Hat, Inc.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
18import os
20from oslo_config import cfg
22ALL_OPTS = [
23 cfg.StrOpt('pybasedir',
24 default=os.path.abspath(os.path.join(os.path.dirname(__file__),
25 '../../')),
26 sample_default='<Path>',
27 help="""
28The directory where the Nova python modules are installed.
30This directory is used to store template files for networking and remote
31console access. It is also the default path for other config options which
32need to persist Nova internal data. It is very unlikely that you need to
33change this option from its default value.
35Possible values:
37* The full path to a directory.
39Related options:
41* ``state_path``
42"""),
44 cfg.StrOpt('state_path',
45 default='$pybasedir',
46 help="""
47The top-level directory for maintaining Nova's state.
49This directory is used to store Nova's internal state. It is used by a
50variety of other config options which derive from this. In some scenarios
51(for example migrations) it makes sense to use a storage location which is
52shared between multiple compute hosts (for example via NFS). Unless the
53option ``instances_path`` gets overwritten, this directory can grow very
54large.
56Possible values:
58* The full path to a directory. Defaults to value provided in ``pybasedir``.
59"""),
60]
63def basedir_def(*args):
64 """Return an uninterpolated path relative to $pybasedir."""
65 return os.path.join('$pybasedir', *args)
68def state_path_def(*args):
69 """Return an uninterpolated path relative to $state_path."""
70 return os.path.join('$state_path', *args)
73def register_opts(conf):
74 conf.register_opts(ALL_OPTS)
77def list_opts():
78 return {"DEFAULT": ALL_OPTS}