fence-agents/bz1470813-fencing-2-fix-power-timeout.patch

41 lines
1.2 KiB
Diff
Raw Normal View History

From 4202a863b25e456b7e419cbfc33c45ae179eb760 Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Thu, 15 Oct 2020 10:34:03 +0200
Subject: [PATCH] fencing: fix power-timeout when using new disable-timeout
parameter
---
lib/fencing.py.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/fencing.py.py b/lib/fencing.py.py
index 4a41af02..4639a9a5 100644
--- a/lib/fencing.py.py
+++ b/lib/fencing.py.py
@@ -10,6 +10,8 @@
import textwrap
import __main__
+import itertools
+
RELEASE_VERSION = "@RELEASE_VERSION@"
__all__ = ['atexit_handler', 'check_input', 'process_input', 'all_opt', 'show_docs',
@@ -821,11 +823,15 @@ def async_set_multi_power_fn(connection, options, set_power_fn, get_power_fn, re
set_power_fn(connection, options)
time.sleep(int(options["--power-wait"]))
- for _ in range(int(options["--power-timeout"])):
+ for _ in itertools.count(1):
if get_multi_power_fn(connection, options, get_power_fn) != options["--action"]:
time.sleep(1)
else:
return True
+
+ if int(options["--power-timeout"]) > 0 and _ >= int(options["--power-timeout"]):
+ break
+
return False
def sync_set_multi_power_fn(connection, options, sync_set_power_fn, retry_attempts):