Coverage for nova/conf/cinder.py: 91%
11 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 (c) 2016 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.
16from keystoneauth1 import loading as ks_loading
17from oslo_config import cfg
19cinder_group = cfg.OptGroup(
20 'cinder',
21 title='Cinder Options',
22 help="Configuration options for the block storage")
24cinder_opts = [
25 cfg.StrOpt('catalog_info',
26 default='volumev3::publicURL',
27 regex=r'^[\w-]+:\w*:.*$',
28 help="""
29Info to match when looking for cinder in the service catalog.
31The ``<service_name>`` is optional and omitted by default since it should
32not be necessary in most deployments.
34Possible values:
36* Format is separated values of the form:
37 <service_type>:<service_name>:<endpoint_type>
39Note: Nova does not support the Cinder v2 API since the Nova 17.0.0 Queens
40release.
42Related options:
44* endpoint_template - Setting this option will override catalog_info
45"""),
46 cfg.StrOpt('endpoint_template',
47 help="""
48If this option is set then it will override service catalog lookup with
49this template for cinder endpoint
51Possible values:
53* URL for cinder endpoint API
54 e.g. http://localhost:8776/v3/%(project_id)s
56Note: Nova does not support the Cinder v2 API since the Nova 17.0.0 Queens
57release.
59Related options:
61* catalog_info - If endpoint_template is not set, catalog_info will be used.
62"""),
63 cfg.StrOpt('os_region_name',
64 help="""
65Region name of this node. This is used when picking the URL in the service
66catalog.
68Possible values:
70* Any string representing region name
71"""),
72 cfg.IntOpt('http_retries',
73 default=3,
74 min=0,
75 help="""
76Number of times cinderclient should retry on any failed http call.
770 means connection is attempted only once. Setting it to any positive integer
78means that on failure connection is retried that many times e.g. setting it
79to 3 means total attempts to connect will be 4.
81Possible values:
83* Any integer value. 0 means connection is attempted only once
84"""),
85 cfg.BoolOpt('cross_az_attach',
86 default=True,
87 help="""
88Allow attach between instance and volume in different availability zones.
90If False, volumes attached to an instance must be in the same availability
91zone in Cinder as the instance availability zone in Nova.
93This also means care should be taken when booting an instance from a volume
94where source is not "volume" because Nova will attempt to create a volume using
95the same availability zone as what is assigned to the instance.
97If that AZ is not in Cinder (or ``allow_availability_zone_fallback=False`` in
98cinder.conf), the volume create request will fail and the instance will fail
99the build request.
101By default there is no availability zone restriction on volume attach.
103Related options:
105* ``[DEFAULT]/default_schedule_zone``
106"""),
107 cfg.BoolOpt('debug',
108 default=False,
109 help="""
110Enable DEBUG logging with cinderclient and os_brick independently of the rest
111of Nova.
112"""),
113]
116def register_opts(conf):
117 conf.register_group(cinder_group)
118 conf.register_opts(cinder_opts, group=cinder_group)
119 ks_loading.register_session_conf_options(conf,
120 cinder_group.name)
121 ks_loading.register_auth_conf_options(conf, cinder_group.name)
124def list_opts():
125 return {
126 cinder_group.name: (
127 cinder_opts +
128 ks_loading.get_session_conf_options() +
129 ks_loading.get_auth_common_conf_options() +
130 ks_loading.get_auth_plugin_conf_options('password') +
131 ks_loading.get_auth_plugin_conf_options('v2password') +
132 ks_loading.get_auth_plugin_conf_options('v3password'))
133 }