main - lvmdbusd: Add a retries during initial load

Tony Asleson <[email protected]>
Newsgroups gmane.linux.lvm.devel
Message-ID <[email protected]>
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=66e79aab367621cbe76bf1e080d6f8693922ea07
Commit:        66e79aab367621cbe76bf1e080d6f8693922ea07
Parent:        9c3b91a513b70e74f21ca40e73f9ad7e3578ac48
Author:        Tony Asleson <[email protected]>
AuthorDate:    Thu Mar 9 11:29:58 2023 -0600
Committer:     Tony Asleson <[email protected]>
CommitterDate: Fri Mar 10 12:51:53 2023 -0600

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.
---
 daemons/lvmdbusd/fetch.py | 13 +++++++++++--
 1 file 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,),

--
lvm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/lvm-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.