config options: Centralize upgrade_levels section

Move config options of nova.conf section "upgrade_levels" to new
centralized location nova/conf/upgrade_levels.

Also, previously some config options for "upgrade_levels" were scattered
in different conf files. Moved these options to the central
location: nova/conf/upgrade_levels.

Change-Id: I45651e8527dd98635f25e9586f68c288203d8cf5
Implements: blueprint centralize-config-options-newton
This commit is contained in:
Sujitha
2016-03-24 21:50:45 +00:00
parent ce5f9c609f
commit bcd5402484
14 changed files with 173 additions and 168 deletions

View File

@@ -18,18 +18,14 @@
Base RPC client and server common to all services. Base RPC client and server common to all services.
""" """
from oslo_config import cfg
import oslo_messaging as messaging import oslo_messaging as messaging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import nova.conf
from nova import rpc from nova import rpc
CONF = cfg.CONF CONF = nova.conf.CONF
rpcapi_cap_opt = cfg.StrOpt('baseapi',
help='Set a version cap for messages sent to the base api in any '
'service')
CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels')
_NAMESPACE = 'baseapi' _NAMESPACE = 'baseapi'

View File

@@ -31,8 +31,4 @@ def list_opts():
nova.compute.manager.timeout_opts, nova.compute.manager.timeout_opts,
nova.compute.rpcapi.rpcapi_opts, nova.compute.rpcapi.rpcapi_opts,
)), )),
('upgrade_levels',
itertools.chain(
[nova.compute.rpcapi.rpcapi_cap_opt],
)),
] ]

View File

@@ -20,6 +20,7 @@ from oslo_log import log as logging
import oslo_messaging as messaging import oslo_messaging as messaging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import nova.conf
from nova import context from nova import context
from nova import exception from nova import exception
from nova.i18n import _, _LI, _LE from nova.i18n import _, _LI, _LE
@@ -35,24 +36,9 @@ rpcapi_opts = [
help='The topic compute nodes listen on'), help='The topic compute nodes listen on'),
] ]
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.register_opts(rpcapi_opts) CONF.register_opts(rpcapi_opts)
rpcapi_cap_opt = cfg.StrOpt('compute',
help='Set a version cap for messages sent to compute services. '
'Set this option to "auto" if you want to let the compute RPC '
'module automatically determine what version to use based on '
'the service versions in the deployment. '
'Otherwise, you can set this to a specific version to pin this '
'service to messages at a particular level. '
'All services of a single type (i.e. compute) should be '
'configured to use the same version, and it should be set '
'to the minimum commonly-supported version of all those '
'services in the deployment.')
CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels')
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
LAST_VERSION = None LAST_VERSION = None

View File

@@ -15,7 +15,6 @@
"""Client side of the conductor RPC API.""" """Client side of the conductor RPC API."""
from oslo_config import cfg
import oslo_messaging as messaging import oslo_messaging as messaging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_versionedobjects import base as ovo_base from oslo_versionedobjects import base as ovo_base
@@ -26,10 +25,6 @@ from nova import rpc
CONF = nova.conf.CONF CONF = nova.conf.CONF
rpcapi_cap_opt = cfg.StrOpt('conductor',
help='Set a version cap for messages sent to conductor services')
CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels')
class ConductorAPI(object): class ConductorAPI(object):
"""Client side of the conductor RPC API """Client side of the conductor RPC API

View File

@@ -68,7 +68,7 @@ from nova.conf import serial_console
# from nova.conf import spice # from nova.conf import spice
# from nova.conf import ssl # from nova.conf import ssl
# from nova.conf import trusted_computing # from nova.conf import trusted_computing
# from nova.conf import upgrade_levels from nova.conf import upgrade_levels
from nova.conf import virt from nova.conf import virt
# from nova.conf import vmware # from nova.conf import vmware
from nova.conf import vnc from nova.conf import vnc
@@ -129,7 +129,7 @@ serial_console.register_opts(CONF)
# spice.register_opts(CONF) # spice.register_opts(CONF)
# ssl.register_opts(CONF) # ssl.register_opts(CONF)
# trusted_computing.register_opts(CONF) # trusted_computing.register_opts(CONF)
# upgrade_levels.register_opts(CONF) upgrade_levels.register_opts(CONF)
virt.register_opts(CONF) virt.register_opts(CONF)
# vmware.register_opts(CONF) # vmware.register_opts(CONF)
vnc.register_opts(CONF) vnc.register_opts(CONF)

View File

@@ -729,57 +729,6 @@ Related options:
""") """)
] ]
rpcapi_cap_intercell_opt = cfg.StrOpt('intercell',
help="""
Intercell version
Intercell RPC API is the client side of the Cell<->Cell RPC API.
Use this option to set a version cap for messages sent between
cells services.
Possible values:
* None: This is the default value.
* grizzly: message version 1.0.
Services which consume this:
* nova-cells
Related options:
* None
""")
rpcapi_cap_cells_opt = cfg.StrOpt('cells',
help="""
Cells version
Cells client-side RPC API version. Use this option to set a version
cap for messages sent to local cells services.
Possible values:
* None: This is the default value.
* grizzly: message version 1.6.
* havana: message version 1.24.
* icehouse: message version 1.27.
* juno: message version 1.29.
* kilo: message version 1.34.
* liberty: message version 1.37.
Services which consume this:
* nova-cells
Related options:
* None
""")
ALL_CELLS_OPTS = list(itertools.chain( ALL_CELLS_OPTS = list(itertools.chain(
cells_opts, cells_opts,
mute_weigher_opts, mute_weigher_opts,
@@ -792,17 +741,10 @@ ALL_CELLS_OPTS = list(itertools.chain(
cell_state_manager_opts cell_state_manager_opts
)) ))
ALL_RPCAPI_CAP_OPTS = [rpcapi_cap_intercell_opt,
rpcapi_cap_cells_opt]
def register_opts(conf): def register_opts(conf):
conf.register_opts(ALL_CELLS_OPTS, group="cells") conf.register_opts(ALL_CELLS_OPTS, group="cells")
conf.register_opts(ALL_RPCAPI_CAP_OPTS, group="upgrade_levels")
def list_opts(): def list_opts():
return { return {'cells': ALL_CELLS_OPTS}
'cells': ALL_CELLS_OPTS,
'upgrade_levels': ALL_RPCAPI_CAP_OPTS,
}

View File

@@ -35,32 +35,10 @@ Any string.
None None
""") """)
rpcapi_cap_opt = cfg.StrOpt("cert",
help="""
Specifies the maximum version for messages sent from cert services. This should
be the minimum value that is supported by all of the deployed cert services.
Possible values:
Any valid OpenStack release name, in lower case, such as 'mitaka' or 'liberty'.
Alternatively, it can be any string representing a version number in the format
'N.N'; for example, possible values might be '1.12' or '2.0'.
* Services which consume this:
``nova-cert``
* Related options:
None
""")
def register_opts(conf): def register_opts(conf):
conf.register_opts([cert_topic_opt]) conf.register_opts([cert_topic_opt])
conf.register_opt(rpcapi_cap_opt, "upgrade_levels")
def list_opts(): def list_opts():
return {"DEFAULT": [cert_topic_opt], return {"DEFAULT": [cert_topic_opt]}
"upgrade_levels": [rpcapi_cap_opt]}

View File

@@ -19,7 +19,6 @@ DEFAULT_GROUP_NAME = "DEFAULT"
# The scheduler has options in several groups # The scheduler has options in several groups
METRICS_GROUP_NAME = "metrics" METRICS_GROUP_NAME = "metrics"
TRUSTED_GROUP_NAME = "trusted_computing" TRUSTED_GROUP_NAME = "trusted_computing"
UPGRADE_GROUP_NAME = "upgrade_levels"
host_subset_size_opt = cfg.IntOpt("scheduler_host_subset_size", host_subset_size_opt = cfg.IntOpt("scheduler_host_subset_size",
@@ -388,28 +387,6 @@ which will *always* be restricted to isolated hosts.
scheduler/isolated_hosts scheduler/isolated_hosts
""") """)
# This option specifies an option group, so register separately
rpcapi_cap_opt = cfg.StrOpt("scheduler",
help="""
Sets a version cap (limit) for messages sent to scheduler services. In the
situation where there were multiple scheduler services running, and they were
not being upgraded together, you would set this to the lowest deployed version
to guarantee that other services never send messages that any of your running
schedulers cannot understand.
This is rarely needed in practice as most deployments run a single scheduler.
It exists mainly for design compatibility with the other services, such as
compute, which are routinely upgraded in a rolling fashion.
* Services that use this:
``nova-compute, nova-conductor``
* Related options:
None
""")
# These opts are registered as a separate OptGroup # These opts are registered as a separate OptGroup
trusted_opts = [ trusted_opts = [
cfg.StrOpt("attestation_server", cfg.StrOpt("attestation_server",
@@ -943,7 +920,6 @@ default_opts = [host_subset_size_opt,
def register_opts(conf): def register_opts(conf):
conf.register_opts(default_opts) conf.register_opts(default_opts)
conf.register_opt(rpcapi_cap_opt, UPGRADE_GROUP_NAME)
trust_group = cfg.OptGroup(name=TRUSTED_GROUP_NAME, trust_group = cfg.OptGroup(name=TRUSTED_GROUP_NAME,
title="Trust parameters") title="Trust parameters")
conf.register_group(trust_group) conf.register_group(trust_group)
@@ -953,7 +929,6 @@ def register_opts(conf):
def list_opts(): def list_opts():
return {DEFAULT_GROUP_NAME: default_opts, return {DEFAULT_GROUP_NAME: default_opts,
UPGRADE_GROUP_NAME: [rpcapi_cap_opt],
TRUSTED_GROUP_NAME: trusted_opts, TRUSTED_GROUP_NAME: trusted_opts,
METRICS_GROUP_NAME: metrics_weight_opts, METRICS_GROUP_NAME: metrics_weight_opts,
} }

158
nova/conf/upgrade_levels.py Normal file
View File

@@ -0,0 +1,158 @@
# 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 oslo_config import cfg
upgrade_group = cfg.OptGroup('upgrade_levels',
title='Upgrade levels Options')
rpcapi_cap_cells_opt = cfg.StrOpt('cells',
help="""
Cells version
Cells client-side RPC API version. Use this option to set a version
cap for messages sent to local cells services.
Possible values:
* None: This is the default value.
* grizzly: message version 1.6.
* havana: message version 1.24.
* icehouse: message version 1.27.
* juno: message version 1.29.
* kilo: message version 1.34.
* liberty: message version 1.37.
Services which consume this:
* nova-cells
Related options:
* None
""")
rpcapi_cap_intercell_opt = cfg.StrOpt('intercell',
help="""
Intercell version
Intercell RPC API is the client side of the Cell<->Cell RPC API.
Use this option to set a version cap for messages sent between
cells services.
Possible values:
* None: This is the default value.
* grizzly: message version 1.0.
Services which consume this:
* nova-cells
Related options:
* None
""")
rpcapi_cap_cert_opt = cfg.StrOpt("cert",
help="""
Specifies the maximum version for messages sent from cert services. This should
be the minimum value that is supported by all of the deployed cert services.
Possible values:
Any valid OpenStack release name, in lower case, such as 'mitaka' or 'liberty'.
Alternatively, it can be any string representing a version number in the format
'N.N'; for example, possible values might be '1.12' or '2.0'.
Services which consume this:
* nova-cert
Related options:
* None
""")
rpcapi_cap_compute_opt = cfg.StrOpt('compute',
help='Set a version cap for messages sent to compute services. '
'Set this option to "auto" if you want to let the compute RPC '
'module automatically determine what version to use based on '
'the service versions in the deployment. '
'Otherwise, you can set this to a specific version to pin this '
'service to messages at a particular level. '
'All services of a single type (i.e. compute) should be '
'configured to use the same version, and it should be set '
'to the minimum commonly-supported version of all those '
'services in the deployment.')
rpcapi_cap_scheduler_opt = cfg.StrOpt("scheduler",
help="""
Sets a version cap (limit) for messages sent to scheduler services. In the
situation where there were multiple scheduler services running, and they were
not being upgraded together, you would set this to the lowest deployed version
to guarantee that other services never send messages that any of your running
schedulers cannot understand.
This is rarely needed in practice as most deployments run a single scheduler.
It exists mainly for design compatibility with the other services, such as
compute, which are routinely upgraded in a rolling fashion.
Services that use this:
* nova-compute, nova-conductor
Related options:
* None
""")
rpcapi_cap_conductor_opt = cfg.StrOpt('conductor',
help='Set a version cap for messages sent to conductor services')
rpcapi_cap_console_opt = cfg.StrOpt('console',
help='Set a version cap for messages sent to console services')
rpcapi_cap_consoleauth_opt = cfg.StrOpt('consoleauth',
help='Set a version cap for messages sent to consoleauth services')
rpcapi_cap_network_opt = cfg.StrOpt('network',
help='Set a version cap for messages sent to network services')
rpcapi_cap_baseapi_opt = cfg.StrOpt('baseapi',
help='Set a version cap for messages sent to the base api in any '
'service')
ALL_OPTS = [rpcapi_cap_cells_opt,
rpcapi_cap_intercell_opt,
rpcapi_cap_cert_opt,
rpcapi_cap_compute_opt,
rpcapi_cap_scheduler_opt,
rpcapi_cap_conductor_opt,
rpcapi_cap_console_opt,
rpcapi_cap_consoleauth_opt,
rpcapi_cap_network_opt,
rpcapi_cap_baseapi_opt]
def register_opts(conf):
conf.register_group(upgrade_group)
conf.register_opts(ALL_OPTS, group=upgrade_group)
def list_opts():
return {upgrade_group: ALL_OPTS}

View File

@@ -19,6 +19,7 @@ Client side of the console RPC API.
from oslo_config import cfg from oslo_config import cfg
import oslo_messaging as messaging import oslo_messaging as messaging
import nova.conf
from nova import rpc from nova import rpc
rpcapi_opts = [ rpcapi_opts = [
@@ -27,13 +28,9 @@ rpcapi_opts = [
help='The topic console proxy nodes listen on'), help='The topic console proxy nodes listen on'),
] ]
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.register_opts(rpcapi_opts) CONF.register_opts(rpcapi_opts)
rpcapi_cap_opt = cfg.StrOpt('console',
help='Set a version cap for messages sent to console services')
CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels')
class ConsoleAPI(object): class ConsoleAPI(object):
'''Client side of the console rpc API. '''Client side of the console rpc API.

View File

@@ -16,16 +16,12 @@
Client side of the consoleauth RPC API. Client side of the consoleauth RPC API.
""" """
from oslo_config import cfg
import oslo_messaging as messaging import oslo_messaging as messaging
import nova.conf
from nova import rpc from nova import rpc
CONF = cfg.CONF CONF = nova.conf.CONF
rpcapi_cap_opt = cfg.StrOpt('consoleauth',
help='Set a version cap for messages sent to consoleauth services')
CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels')
class ConsoleAuthAPI(object): class ConsoleAuthAPI(object):

View File

@@ -32,8 +32,4 @@ def list_opts():
nova.network.security_group.openstack_driver.security_group_opts, nova.network.security_group.openstack_driver.security_group_opts,
)), )),
('neutron', nova.network.neutronv2.api.neutron_opts), ('neutron', nova.network.neutronv2.api.neutron_opts),
('upgrade_levels',
itertools.chain(
[nova.network.rpcapi.rpcapi_cap_opt],
)),
] ]

View File

@@ -20,6 +20,7 @@ from oslo_config import cfg
import oslo_messaging as messaging import oslo_messaging as messaging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import nova.conf
from nova.objects import base as objects_base from nova.objects import base as objects_base
from nova import rpc from nova import rpc
@@ -33,13 +34,9 @@ rpcapi_opts = [
'some rpc network calls will be sent directly to host.'), 'some rpc network calls will be sent directly to host.'),
] ]
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.register_opts(rpcapi_opts) CONF.register_opts(rpcapi_opts)
rpcapi_cap_opt = cfg.StrOpt('network',
help='Set a version cap for messages sent to network services')
CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels')
class NetworkAPI(object): class NetworkAPI(object):
'''Client side of the network rpc API. '''Client side of the network rpc API.

View File

@@ -78,12 +78,5 @@ def list_opts():
itertools.chain( itertools.chain(
nova.cmd.spicehtml5proxy.opts, nova.cmd.spicehtml5proxy.opts,
nova.spice.spice_opts, nova.spice.spice_opts,
)), ))
('upgrade_levels',
itertools.chain(
[nova.baserpc.rpcapi_cap_opt],
[nova.conductor.rpcapi.rpcapi_cap_opt],
[nova.console.rpcapi.rpcapi_cap_opt],
[nova.consoleauth.rpcapi.rpcapi_cap_opt],
)),
] ]