]> xenbits.xensource.com Git - osstest/openstack-nova.git/commitdiff
Log warning when user set improper config option value
authorChangBo Guo(gcb) <eric.guo@easystack.cn>
Fri, 12 Aug 2016 05:05:01 +0000 (13:05 +0800)
committerChangBo Guo(gcb) <glongwave@gmail.com>
Thu, 3 Nov 2016 11:41:45 +0000 (11:41 +0000)
User may set wrong values for live migration related config options,
log warning when setting with wrong values, will use parameter min
of IntOpt to enforce these config options' values in Pike.

Change-Id: I064958998939da3e05bd04631a36d2a507bf50c1

nova/virt/libvirt/driver.py

index 8ef19100d06e693ef3a89cfe38a9dbf453178d56..885fe0d1e5f868ae3e87b4f5740aa612373ca5e1 100644 (file)
@@ -6002,15 +6002,32 @@ class LibvirtDriver(driver.ComputeDriver):
         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 < nova.conf.libvirt.LIVE_MIGRATION_DOWNTIME_MIN:
-            downtime = nova.conf.libvirt.LIVE_MIGRATION_DOWNTIME_MIN
-        if steps < nova.conf.libvirt.LIVE_MIGRATION_DOWNTIME_STEPS_MIN:
-            steps = nova.conf.libvirt.LIVE_MIGRATION_DOWNTIME_STEPS_MIN
-        if delay < nova.conf.libvirt.LIVE_MIGRATION_DOWNTIME_DELAY_MIN:
-            delay = nova.conf.libvirt.LIVE_MIGRATION_DOWNTIME_DELAY_MIN
+        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)
 
         offset = downtime / float(steps + 1)