summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Asleson <tasleson@redhat.com>2023-03-09 11:29:58 -0600
committerTony Asleson <tasleson@redhat.com>2023-03-10 12:51:53 -0600
commit66e79aab367621cbe76bf1e080d6f8693922ea07 (patch)
tree2de0acec228feaa75904ee68f1bf61a3cd93d956
parent9c3b91a513b70e74f21ca40e73f9ad7e3578ac48 (diff)
downloadlvm2-66e79aab367621cbe76bf1e080d6f8693922ea07.tar.gz
lvmdbusd: Add a retries during initial load
When the daemon is starting we do an initial fetch of lvm state. If we happened to get some type of failure with lvm during this time we would exit. During error injection testing this happened enough that the unit tests were unable to finish. Add retries to ensure we can get started during error injection testing.
-rw-r--r--daemons/lvmdbusd/fetch.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/daemons/lvmdbusd/fetch.py b/daemons/lvmdbusd/fetch.py
index 9da62590a..9807da934 100644
--- a/daemons/lvmdbusd/fetch.py
+++ b/daemons/lvmdbusd/fetch.py
@@ -228,8 +228,17 @@ class StateUpdate(object):
self.queue = queue.Queue()
self.deferred = False
- # Do initial load
- load(refresh=False, emit_signal=False, need_main_thread=False)
+ # Do initial load, with retries. During error injection testing we can and do fail here.
+ count = 0
+ need_refresh = False # First attempt we are building from new, any subsequent will be true
+ while count < 5:
+ try:
+ load(refresh=need_refresh, emit_signal=False, need_main_thread=False)
+ break
+ except LvmBug as bug:
+ count += 1
+ need_refresh = True
+ log_error("We encountered an lvm bug on initial load, trying again %s" % str(bug))
self.thread = threading.Thread(target=StateUpdate.update_thread,
args=(self,),