summaryrefslogtreecommitdiff
path: root/nova/conf/neutron.py
blob: e6774ced55ab06a37f1fc7873594ff0eb5f2d09b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# Copyright 2016 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 keystoneauth1 import loading as ks_loading
from oslo_config import cfg

from nova.conf import utils as confutils


DEFAULT_SERVICE_TYPE = 'network'
NEUTRON_GROUP = 'neutron'

neutron_group = cfg.OptGroup(
    NEUTRON_GROUP,
    title='Neutron Options',
    help="""
Configuration options for neutron (network connectivity as a service).
""")

neutron_opts = [
    cfg.StrOpt('ovs_bridge',
         default='br-int',
         help="""
Default name for the Open vSwitch integration bridge.

Specifies the name of an integration bridge interface used by OpenvSwitch.
This option is only used if Neutron does not specify the OVS bridge name in
port binding responses.
"""),
    cfg.StrOpt('default_floating_pool',
        default='nova',
        help="""
Default name for the floating IP pool.

Specifies the name of floating IP pool used for allocating floating IPs. This
option is only used if Neutron does not specify the floating IP pool name in
port binding responses.
"""),
    cfg.IntOpt('extension_sync_interval',
         default=600,
         min=0,
         help="""
Integer value representing the number of seconds to wait before querying
Neutron for extensions.  After this number of seconds the next time Nova
needs to create a resource in Neutron it will requery Neutron for the
extensions that it has loaded.  Setting value to 0 will refresh the
extensions with no wait.
"""),
    cfg.ListOpt('physnets',
        default=[],
        help="""
List of physnets present on this host.

For each *physnet* listed, an additional section,
``[neutron_physnet_$PHYSNET]``, will be added to the configuration file. Each
section must be configured with a single configuration option, ``numa_nodes``,
which should be a list of node IDs for all NUMA nodes this physnet is
associated with. For example::

    [neutron]
    physnets = foo, bar

    [neutron_physnet_foo]
    numa_nodes = 0

    [neutron_physnet_bar]
    numa_nodes = 0,1

Any *physnet* that is not listed using this option will be treated as having no
particular NUMA node affinity.

Tunnelled networks (VXLAN, GRE, ...) cannot be accounted for in this way and
are instead configured using the ``[neutron_tunnel]`` group. For example::

    [neutron_tunnel]
    numa_nodes = 1

Related options:

* ``[neutron_tunnel] numa_nodes`` can be used to configure NUMA affinity for
  all tunneled networks
* ``[neutron_physnet_$PHYSNET] numa_nodes`` must be configured for each value
  of ``$PHYSNET`` specified by this option
"""),
    cfg.IntOpt('http_retries',
               default=3,
               min=0,
               help="""
Number of times neutronclient should retry on any failed http call.

0 means connection is attempted only once. Setting it to any positive integer
means that on failure connection is retried that many times e.g. setting it
to 3 means total attempts to connect will be 4.

Possible values:

* Any integer value. 0 means connection is attempted only once
"""),
]

metadata_proxy_opts = [
    cfg.BoolOpt("service_metadata_proxy",
        default=False,
        help="""
When set to True, this option indicates that Neutron will be used to proxy
metadata requests and resolve instance ids. Otherwise, the instance ID must be
passed to the metadata request in the 'X-Instance-ID' header.

Related options:

* metadata_proxy_shared_secret
"""),
     cfg.StrOpt("metadata_proxy_shared_secret",
        default="",
        secret=True,
        help="""
This option holds the shared secret string used to validate proxy requests to
Neutron metadata requests. In order to be used, the
'X-Metadata-Provider-Signature' header must be supplied in the request.

Related options:

* service_metadata_proxy
"""),
]

ALL_OPTS = (neutron_opts + metadata_proxy_opts)


def register_opts(conf):
    conf.register_group(neutron_group)
    conf.register_opts(ALL_OPTS, group=neutron_group)
    confutils.register_ksa_opts(conf, neutron_group, DEFAULT_SERVICE_TYPE)


def register_dynamic_opts(conf):
    """Register dynamically-generated options and groups.

    This must be called by the service that wishes to use the options **after**
    the initial configuration has been loaded.
    """
    opt = cfg.ListOpt('numa_nodes', default=[], item_type=cfg.types.Integer())

    # Register the '[neutron_tunnel] numa_nodes' opt, implicitly
    # registering the '[neutron_tunnel]' group in the process. This could
    # be done statically but is done to avoid this group appearing in
    # nova.conf documentation while the other group does not.
    conf.register_opt(opt, group='neutron_tunnel')

    # Register the '[neutron_physnet_$PHYSNET] numa_nodes' opts, implicitly
    # registering the '[neutron_physnet_$PHYSNET]' groups in the process
    for physnet in conf.neutron.physnets:
        conf.register_opt(opt, group='neutron_physnet_%s' % physnet)


def list_opts():
    return {
        neutron_group: (
            ALL_OPTS +
            ks_loading.get_session_conf_options() +
            ks_loading.get_auth_common_conf_options() +
            ks_loading.get_auth_plugin_conf_options('password') +
            ks_loading.get_auth_plugin_conf_options('v2password') +
            ks_loading.get_auth_plugin_conf_options('v3password') +
            confutils.get_ksa_adapter_opts(DEFAULT_SERVICE_TYPE))
    }