config options: centralize section "workarounds"

The config options of the "nova.conf" section "workarounds"
got moved to the new central location "nova/conf/workarounds.py".

Change-Id: I0d3296999f7209fa8a07d7b89ec1d41dc3b35118
Implements: blueprint centralize-config-options-newton
This commit is contained in:
Wanlong Gao 2016-03-26 10:55:10 +08:00 committed by Stephen Finucane
parent d233772b0d
commit 9c1df17547
6 changed files with 98 additions and 65 deletions

View File

@ -269,7 +269,6 @@ CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('enabled', 'nova.spice', group='spice')
CONF.import_opt('enabled', 'nova.mks', group='mks')
CONF.import_opt('mksproxy_base_url', 'nova.mks', group='mks')
CONF.import_opt('destroy_after_evacuate', 'nova.utils', group='workarounds')
LOG = logging.getLogger(__name__)

View File

@ -72,7 +72,7 @@ from nova.conf import virt
# from nova.conf import vmware
from nova.conf import vnc
# from nova.conf import volume
# from nova.conf import workarounds
from nova.conf import workarounds
from nova.conf import wsgi
from nova.conf import xenserver
# from nova.conf import xvp
@ -132,7 +132,7 @@ virt.register_opts(CONF)
# vmware.register_opts(CONF)
vnc.register_opts(CONF)
# volume.register_opts(CONF)
# workarounds.register_opts(CONF)
workarounds.register_opts(CONF)
wsgi.register_opts(CONF)
xenserver.register_opts(CONF)
# xvp.register_opts(CONF)

94
nova/conf/workarounds.py Normal file
View File

@ -0,0 +1,94 @@
# 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.
""" The workarounds_opts group is for very specific reasons.
If you're:
- Working around an issue in a system tool (e.g. libvirt or qemu) where the
fix is in flight/discussed in that community.
- The tool can be/is fixed in some distributions and rather than patch the
code those distributions can trivially set a config option to get the
"correct" behavior.
Then this is a good place for your workaround.
.. warning::
Please use with care! Document the BugID that your workaround is paired with.
"""
from oslo_config import cfg
disable_rootwrap = cfg.BoolOpt(
'disable_rootwrap',
default=False,
help='This option allows a fallback to sudo for performance '
'reasons. For example see '
'https://bugs.launchpad.net/nova/+bug/1415106')
disable_libvirt_livesnapshot = cfg.BoolOpt(
'disable_libvirt_livesnapshot',
default=True,
help='When using libvirt 1.2.2 live snapshots fail '
'intermittently under load. This config option provides '
'a mechanism to enable live snapshot while this is '
'resolved. See '
'https://bugs.launchpad.net/nova/+bug/1334398')
destroy_after_evacuate = cfg.BoolOpt(
'destroy_after_evacuate',
default=True,
deprecated_for_removal=True,
help='DEPRECATED: Whether to destroy '
'instances on startup when we suspect '
'they have previously been evacuated. This can result in '
'data loss if undesired. See '
'https://launchpad.net/bugs/1419785')
handle_virt_lifecycle_events = cfg.BoolOpt(
'handle_virt_lifecycle_events',
default=True,
help="Whether or not to handle events raised from the compute "
"driver's 'emit_event' method. These are lifecycle "
"events raised from compute drivers that implement the "
"method. An example of a lifecycle event is an instance "
"starting or stopping. If the instance is going through "
"task state changes due to an API operation, like "
"resize, the events are ignored. However, this is an "
"advanced feature which allows the hypervisor to signal "
"to the compute service that an unexpected state change "
"has occurred in an instance and the instance can be "
"shutdown automatically - which can inherently race in "
"reboot operations or when the compute service or host "
"is rebooted, either planned or due to an unexpected "
"outage. Care should be taken when using this and "
"sync_power_state_interval is negative since then if any "
"instances are out of sync between the hypervisor and "
"the Nova database they will have to be synchronized "
"manually. See https://bugs.launchpad.net/bugs/1444630")
ALL_OPTS = [disable_rootwrap,
disable_libvirt_livesnapshot,
destroy_after_evacuate,
handle_virt_lifecycle_events]
def register_opts(conf):
conf.register_opts(ALL_OPTS, group='workarounds')
def list_opts():
return {'workarounds': ALL_OPTS}

View File

@ -92,5 +92,4 @@ def list_opts():
[nova.console.rpcapi.rpcapi_cap_opt],
[nova.consoleauth.rpcapi.rpcapi_cap_opt],
)),
('workarounds', nova.utils.workarounds_opts),
]

View File

@ -54,6 +54,7 @@ from oslo_utils import units
import six
from six.moves import range
import nova.conf
from nova import exception
from nova.i18n import _, _LE, _LI, _LW
import nova.network
@ -92,69 +93,10 @@ utils_opts = [
help='Explicitly specify the temporary working directory'),
]
workarounds_opts = [
cfg.BoolOpt('disable_rootwrap',
default=False,
help='This option allows a fallback to sudo for performance '
'reasons. For example see '
'https://bugs.launchpad.net/nova/+bug/1415106'),
cfg.BoolOpt('disable_libvirt_livesnapshot',
default=True,
help='When using libvirt 1.2.2 live snapshots fail '
'intermittently under load. This config option provides '
'a mechanism to enable live snapshot while this is '
'resolved. See '
'https://bugs.launchpad.net/nova/+bug/1334398'),
cfg.BoolOpt('destroy_after_evacuate',
default=True,
deprecated_for_removal=True,
help='DEPRECATED: Whether to destroy '
'instances on startup when we suspect '
'they have previously been evacuated. This can result in '
'data loss if undesired. See '
'https://launchpad.net/bugs/1419785'),
cfg.BoolOpt('handle_virt_lifecycle_events',
default=True,
help="Whether or not to handle events raised from the compute "
"driver's 'emit_event' method. These are lifecycle "
"events raised from compute drivers that implement the "
"method. An example of a lifecycle event is an instance "
"starting or stopping. If the instance is going through "
"task state changes due to an API operation, like "
"resize, the events are ignored. However, this is an "
"advanced feature which allows the hypervisor to signal "
"to the compute service that an unexpected state change "
"has occurred in an instance and the instance can be "
"shutdown automatically - which can inherently race in "
"reboot operations or when the compute service or host "
"is rebooted, either planned or due to an unexpected "
"outage. Care should be taken when using this and "
"sync_power_state_interval is negative since then if any "
"instances are out of sync between the hypervisor and "
"the Nova database they will have to be synchronized "
"manually. See https://bugs.launchpad.net/bugs/1444630"),
]
""" The workarounds_opts group is for very specific reasons.
If you're:
- Working around an issue in a system tool (e.g. libvirt or qemu) where the
fix is in flight/discussed in that community.
- The tool can be/is fixed in some distributions and rather than patch the
code those distributions can trivially set a config option to get the
"correct" behavior.
Then this is a good place for your workaround.
.. warning::
Please use with care! Document the BugID that your workaround is paired with.
"""
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.register_opts(monkey_patch_opts)
CONF.register_opts(utils_opts)
CONF.register_opts(workarounds_opts, group='workarounds')
LOG = logging.getLogger(__name__)

View File

@ -318,7 +318,6 @@ CONF.import_opt('live_migration_retry_count', 'nova.compute.manager')
CONF.import_opt('server_proxyclient_address', 'nova.spice', group='spice')
CONF.import_opt('hw_disk_discard', 'nova.virt.libvirt.imagebackend',
group='libvirt')
CONF.import_group('workarounds', 'nova.utils')
CONF.import_opt('iscsi_use_multipath', 'nova.virt.libvirt.volume.iscsi',
group='libvirt')