diff options
author | Jonas Bjurel <jonas.bjurel@ericsson.com> | 2016-06-15 17:19:03 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-06-15 17:19:03 +0000 |
commit | c59787fe116c7ac0c2c0105a71ca17e6d846e7ce (patch) | |
tree | 45a4be8d4b055af611becb907d607de74d65a98d /INFO | |
parent | 2cc44f07459847e9d5807aaaace8b2890605bed8 (diff) |
Updated armband
Project: fuel aa58ccd04bfa98ae2bfbf2e37a180020e331deaf
common.py: allow specifying number of attempts in exec_cmd
Some commands executed by exec_cmd may fail because of a temporary
cause, and it may be desirable to retry the same command several times
until it succeeds. One example of this are the ipmitool commands, which
may fail temorarily on some targets if they get too many requests
simultaneously.
In this patch three new optional parameters are introduced to the
function signature, which do not break backward compatibility:
attempts: which indicates how many times the command should be run if
it returns a non-zero value*, and defaults to 1 (as today).
delay: which indicates the delay in seconds between attempts, and
defaults to 5 seconds.
verbose: It will print the remaining attempts left for the current
command if set to True.
* It may be desirable to add yet another parameter to indicate what
return value should be considered an error, but non-zero for now
seems a reasonable default.
Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
ipmi_adapter: simplify, retry if command fails
The method get_node_state has been added to the the IpmiAdapter class.
In addition, now the power on/off methods will try several times to
perform their IPMI command before giving up, instead of bailing out at
the first error.
After the power on/off command is completed, the method will wait until
the node is in the desired state.
NOTE: a command could potentially take several minutes if the defaults
are used; each IPMI command can take up to 1 minute, and there can be 3
commands issued per operation, one of them may be retried 20 times with
the current defaults. Ideally we would use eventlet or something similar
to allow each command a limited time to execute, instead:
with eventlet.timeout.Timeout(seconds) as t:
power_on/off_command
Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
Diffstat (limited to 'INFO')
0 files changed, 0 insertions, 0 deletions