From 709c9cb73eea5888d29f96ba3ba3b53cd5ebc44a Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 13 Dec 2023 14:41:47 -0500 Subject: [PATCH] Pause pvchealthd startup until node daemon is run If the health daemon starts too soon during a node bootup, it will generate generate tons of erroneous faults while the node starts up. Adds a conditional wait for the current node daemon to be in "run" state before the health daemon really starts up. --- health-daemon/pvchealthd/Daemon.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/health-daemon/pvchealthd/Daemon.py b/health-daemon/pvchealthd/Daemon.py index 4d7349f4..8a1d5130 100644 --- a/health-daemon/pvchealthd/Daemon.py +++ b/health-daemon/pvchealthd/Daemon.py @@ -80,6 +80,11 @@ def entrypoint(): # Connect to Zookeeper and return our handler and current schema version zkhandler, _ = pvchealthd.util.zookeeper.connect(logger, config) + logger.out("Waiting for node daemon to be operating", state="s") + while zkhandler.read(("node.state.daemon", config["node_hostname"])) != "run": + sleep(5) + logger.out("Node daemon in run state, continuing health daemon startup", state="s") + # Define a cleanup function def cleanup(failure=False): nonlocal logger, zkhandler, monitoring_instance