From c59787fe116c7ac0c2c0105a71ca17e6d846e7ce Mon Sep 17 00:00:00 2001 From: Jonas Bjurel Date: Wed, 15 Jun 2016 17:19:03 +0000 Subject: 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 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 --- upstream/fuel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'upstream') diff --git a/upstream/fuel b/upstream/fuel index c47a7f7a..aa58ccd0 160000 --- a/upstream/fuel +++ b/upstream/fuel @@ -1 +1 @@ -Subproject commit c47a7f7a0198e2ce6ba54cbe485ae87983f785d2 +Subproject commit aa58ccd04bfa98ae2bfbf2e37a180020e331deaf -- cgit 1.2.3-korg