1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Tony Asleson 2023-03-09 11:29:58 -06:00
parent 9c3b91a513
commit 66e79aab36

View File

@ -228,8 +228,17 @@ class StateUpdate(object):
self.queue = queue.Queue() self.queue = queue.Queue()
self.deferred = False self.deferred = False
# Do initial load # Do initial load, with retries. During error injection testing we can and do fail here.
load(refresh=False, emit_signal=False, need_main_thread=False) 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, self.thread = threading.Thread(target=StateUpdate.update_thread,
args=(self,), args=(self,),