diff mbox series

[v2,11/12] libmultipath: don't log boring state messages at level 3

Message ID 20241112150215.90182-12-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: Benjamin Marzinski
Headers show
Series multipath fixes to tableless device handling | expand

Commit Message

Martin Wilck Nov. 12, 2024, 3:02 p.m. UTC
Even at verbosity level 3, it isn't interesting and actually disturbing
to see every successful state and pending state logged by multipathd.
Suppress these messages at level 3.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/discovery.c | 11 ++++++++---
 libmultipath/structs.h   |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 1d48c30..ae9fc8f 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -2018,15 +2018,20 @@  int
 get_state (struct path * pp)
 {
 	struct checker * c = &pp->checker;
-	int state;
+	int state, lvl;
 
 	state = checker_get_state(c);
-	condlog(3, "%s: %s state = %s", pp->dev,
+
+	lvl = state == pp->oldstate || state == PATH_PENDING ? 4 : 3;
+	condlog(lvl, "%s: %s state = %s", pp->dev,
 		checker_name(c), checker_state_name(state));
 	if (state != PATH_UP && state != PATH_GHOST &&
 	    strlen(checker_message(c)))
-		condlog(3, "%s: %s checker%s",
+		condlog(lvl, "%s: %s checker%s",
 			pp->dev, checker_name(c), checker_message(c));
+	if (state != PATH_PENDING)
+		pp->oldstate = state;
+
 	return state;
 }
 
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 1f531d3..4821f19 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -375,6 +375,7 @@  struct path {
 	int state;
 	int dmstate;
 	int chkrstate;
+	int oldstate;
 	int failcount;
 	int priority;
 	int pgindex;