summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Asleson <tasleson@redhat.com>2016-02-22 15:53:31 -0600
committerTony Asleson <tasleson@redhat.com>2016-02-22 16:07:54 -0600
commitecc040688601ec0f4b35f4250e057db13fd847a0 (patch)
tree9ae086735a1c48923db2d0730c47305e7b2584a4
parent21034644b6582a6d9ad571ff51cc57ad5e08b9ff (diff)
downloadlvm2-ecc040688601ec0f4b35f4250e057db13fd847a0.tar.gz
lvmdbusd: Remove unlimited retries
Change while to for loop to prevent the daemon from getting stuck when lvm is messed up. Signed-off-by: Tony Asleson <tasleson@redhat.com>
-rw-r--r--daemons/lvmdbusd/cmdhandler.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 83feb0a45..370fb618c 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -388,6 +388,9 @@ def lv_detach_cache(lv_full_name, detach_options, destroy_cache):
def pv_retrieve_with_segs(device=None):
d = []
+ err = ""
+ out = ""
+ rc = 0
columns = ['pv_name', 'pv_uuid', 'pv_fmt', 'pv_size', 'pv_free',
'pv_used', 'dev_size', 'pv_mda_size', 'pv_mda_free',
@@ -398,7 +401,7 @@ def pv_retrieve_with_segs(device=None):
# Lvm has some issues where it returns failure when querying pvs when other
# operations are in process, see:
# https://bugzilla.redhat.com/show_bug.cgi?id=1274085
- while True:
+ for i in range(0, 10):
cmd = _dc('pvs', ['-o', ','.join(columns)])
if device:
@@ -413,6 +416,13 @@ def pv_retrieve_with_segs(device=None):
time.sleep(0.2)
log_debug("LVM Bug workaround, retrying pvs command...")
+ if rc != 0:
+ msg = "We were unable to get pvs to return without error after " \
+ "trying 10 times, RC=%d, STDERR=(%s), STDOUT=(%s)" % \
+ (rc, err, out)
+ log_error(msg)
+ raise RuntimeError(msg)
+
return d