diff options
author | Yuriy Zveryanskyy <yzveryanskyy@mirantis.com> | 2015-10-13 15:16:21 +0300 |
---|---|---|
committer | Yuriy Zveryanskyy <yzveryanskyy@mirantis.com> | 2015-10-16 16:10:56 +0300 |
commit | bdcf98a3d984d32662d1860af0921917912c1368 (patch) | |
tree | e2ea1be76c02711aace8848a6e4853869c63b4d7 /ironic/drivers/modules/snmp.py | |
parent | 5ca6e64e3387bce287e21ce8da3ed03f9537ae7e (diff) | |
download | ironic-bdcf98a3d984d32662d1860af0921917912c1368.tar.gz |
Add reboot_delay option to snmp driver
When node is powered off via "soft off" (during deploy with agent for
example) a off/on cycle is required on external power controller.
If pause between off and on is too short node's hardware unable
to detect external power loss.
This patch adds new 'reboot_delay' config option. Some of
SNMP-enabled power controller have own value for this pause
(configurable or hardcoded). So default value of Ironic option
is "0" for keeping of current behavior.
Closes-Bug: #1506860
Change-Id: I91617f1a296ad38ff4c31872e6e3ac20f8619a38
Diffstat (limited to 'ironic/drivers/modules/snmp.py')
-rw-r--r-- | ironic/drivers/modules/snmp.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ironic/drivers/modules/snmp.py b/ironic/drivers/modules/snmp.py index 66259e75c..45f63ff92 100644 --- a/ironic/drivers/modules/snmp.py +++ b/ironic/drivers/modules/snmp.py @@ -28,6 +28,7 @@ models. """ import abc +import time from oslo_config import cfg from oslo_log import log as logging @@ -55,7 +56,14 @@ else: opts = [ cfg.IntOpt('power_timeout', default=10, - help=_('Seconds to wait for power action to be completed')) + help=_('Seconds to wait for power action to be completed')), + # NOTE(yuriyz): some of SNMP-enabled hardware have own options for pause + # between off and on. This option guarantees minimal value. + cfg.IntOpt('reboot_delay', + default=0, + min=0, + help=_('Time (in seconds) to sleep between when rebooting ' + '(powering off and on again)')) ] LOG = logging.getLogger(__name__) @@ -310,6 +318,7 @@ class SNMPDriverBase(object): power_result = self.power_off() if power_result != states.POWER_OFF: return states.ERROR + time.sleep(CONF.snmp.reboot_delay) power_result = self.power_on() if power_result != states.POWER_ON: return states.ERROR |