Use min parameter to restrict live-migration config options

UpgradeImpact: IntOpt type provides min parameter to restrict integer's
minimum value in oslo.config, and will generate description about this
in the format like '# Minimum value: XXX', then we don't need round up
the minimum value quietly in code.

Change-Id: I54592ba4f46c2d6260f1513e5e29dd466c89724d
This commit is contained in:
ChangBo Guo(gcb) 2016-05-31 19:46:51 +08:00 committed by Stephen Finucane
parent d4e70a4275
commit 03711d2648
3 changed files with 20 additions and 44 deletions

View File

@ -25,12 +25,6 @@ from oslo_config import cfg
from nova.conf import paths
# Downtime period in milliseconds
LIVE_MIGRATION_DOWNTIME_MIN = 100
# Step count
LIVE_MIGRATION_DOWNTIME_STEPS_MIN = 3
# Delay in seconds
LIVE_MIGRATION_DOWNTIME_DELAY_MIN = 10
libvirt_group = cfg.OptGroup("libvirt",
title="Libvirt Options",
@ -332,15 +326,14 @@ If set to 0, the hypervisor will choose a suitable default. Some hypervisors
do not support this feature and will return an error if bandwidth is not 0.
Please refer to the libvirt documentation for further details.
"""),
# TODO(hieulq): Need to add min argument by moving from
# LIVE_MIGRATION_DOWNTIME_MIN constant.
cfg.IntOpt('live_migration_downtime',
default=500,
min=100,
help="""
Maximum permitted downtime, in milliseconds, for live migration
switchover.
Will be rounded up to a minimum of %dms. You can increase this value
Will be rounded up to a minimum of 100ms. You can increase this value
if you want to allow live-migrations to complete faster, or avoid
live-migration timeout errors by allowing the guest to be paused for
longer during the live-migration switch over.
@ -348,27 +341,25 @@ longer during the live-migration switch over.
Related options:
* live_migration_completion_timeout
""" % LIVE_MIGRATION_DOWNTIME_MIN),
# TODO(hieulq): Need to add min argument by moving from
# LIVE_MIGRATION_DOWNTIME_STEPS_MIN constant.
"""),
cfg.IntOpt('live_migration_downtime_steps',
default=10,
min=3,
help="""
Number of incremental steps to reach max downtime value.
Will be rounded up to a minimum of %d steps.
""" % LIVE_MIGRATION_DOWNTIME_STEPS_MIN),
# TODO(hieulq): Need to add min argument by moving from
# LIVE_MIGRATION_DOWNTIME_DELAY_MIN constant.
Will be rounded up to a minimum of 3 steps.
"""),
cfg.IntOpt('live_migration_downtime_delay',
default=75,
min=3,
help="""
Time to wait, in seconds, between each step increase of the migration
downtime.
Minimum delay is %d seconds. Value is per GiB of guest RAM + disk to be
Minimum delay is 3 seconds. Value is per GiB of guest RAM + disk to be
transferred, with lower bound of a minimum of 2 GiB per device.
""" % LIVE_MIGRATION_DOWNTIME_DELAY_MIN),
"""),
cfg.IntOpt('live_migration_completion_timeout',
default=800,
mutable=True,

View File

@ -526,32 +526,6 @@ def downtime_steps(data_gb):
steps = CONF.libvirt.live_migration_downtime_steps
delay = CONF.libvirt.live_migration_downtime_delay
downtime_min = nova.conf.libvirt.LIVE_MIGRATION_DOWNTIME_MIN
steps_min = nova.conf.libvirt.LIVE_MIGRATION_DOWNTIME_STEPS_MIN
delay_min = nova.conf.libvirt.LIVE_MIGRATION_DOWNTIME_DELAY_MIN
# TODO(hieulq): Need to move min/max value into the config option,
# currently oslo_config will raise ValueError instead of setting
# option value to its min/max.
if downtime < downtime_min:
LOG.warning(_LW("Config option live_migration_downtime's value "
"is less than minimum value %dms, rounded up to "
"the minimum value and will raise ValueError in "
"the future release."), downtime_min)
downtime = downtime_min
if steps < steps_min:
LOG.warning(_LW("Config option live_migration_downtime_steps's "
"value is less than minimum value %dms, rounded "
"up to the minimum value and will raise "
"ValueError in the future release."), steps_min)
steps = steps_min
if delay < delay_min:
LOG.warning(_LW("Config option live_migration_downtime_delay's "
"value is less than minimum value %dms, rounded "
"up to the minimum value and will raise "
"ValueError in the future release."), delay_min)
delay = delay_min
delay = int(delay * data_gb)
base = downtime / steps

View File

@ -0,0 +1,11 @@
---
upgrade:
- |
Three live-migration related configuration options were restricted
by minimum values since 16.0.0 and will now raise a ValueError if these
configuration options' values less than minimum values, instead of
logging warning before. These configuration options are:
- ``live_migration_downtime`` with minimum value 100
- ``live_migration_downtime_steps`` with minimum value 3
- ``live_migration_downtime_delay`` with minimum value 10