Blame SOURCES/0017-Mdmonitor-Improve-logging-method.patch

fdf7c0
From f5ff2988761625b43eb15555993f2797af29f166 Mon Sep 17 00:00:00 2001
fdf7c0
From: Kinga Tanska <kinga.tanska@intel.com>
fdf7c0
Date: Mon, 6 Jun 2022 12:32:13 +0200
fdf7c0
Subject: [PATCH 17/52] Mdmonitor: Improve logging method
fdf7c0
fdf7c0
Change logging, and as a result, mdmonitor in verbose
fdf7c0
mode will report its configuration.
fdf7c0
fdf7c0
Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
fdf7c0
Signed-off-by: Oleksandr Shchirskyi <oleksandr.shchirskyi@intel.com>
fdf7c0
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
fdf7c0
---
fdf7c0
 Monitor.c | 25 ++++++++++++++-----------
fdf7c0
 1 file changed, 14 insertions(+), 11 deletions(-)
fdf7c0
fdf7c0
diff --git a/Monitor.c b/Monitor.c
fdf7c0
index 4e5802b5..6ca1ebe5 100644
fdf7c0
--- a/Monitor.c
fdf7c0
+++ b/Monitor.c
fdf7c0
@@ -136,24 +136,27 @@ int Monitor(struct mddev_dev *devlist,
fdf7c0
 	struct mddev_ident *mdlist;
fdf7c0
 	int delay_for_event = c->delay;
fdf7c0
 
fdf7c0
-	if (!mailaddr) {
fdf7c0
+	if (!mailaddr)
fdf7c0
 		mailaddr = conf_get_mailaddr();
fdf7c0
-		if (mailaddr && ! c->scan)
fdf7c0
-			pr_err("Monitor using email address \"%s\" from config file\n",
fdf7c0
-			       mailaddr);
fdf7c0
-	}
fdf7c0
-	mailfrom = conf_get_mailfrom();
fdf7c0
 
fdf7c0
-	if (!alert_cmd) {
fdf7c0
+	if (!alert_cmd)
fdf7c0
 		alert_cmd = conf_get_program();
fdf7c0
-		if (alert_cmd && !c->scan)
fdf7c0
-			pr_err("Monitor using program \"%s\" from config file\n",
fdf7c0
-			       alert_cmd);
fdf7c0
-	}
fdf7c0
+
fdf7c0
+	mailfrom = conf_get_mailfrom();
fdf7c0
+
fdf7c0
 	if (c->scan && !mailaddr && !alert_cmd && !dosyslog) {
fdf7c0
 		pr_err("No mail address or alert command - not monitoring.\n");
fdf7c0
 		return 1;
fdf7c0
 	}
fdf7c0
+
fdf7c0
+	if (c->verbose) {
fdf7c0
+		pr_err("Monitor is started with delay %ds\n", c->delay);
fdf7c0
+		if (mailaddr)
fdf7c0
+			pr_err("Monitor using email address %s\n", mailaddr);
fdf7c0
+		if (alert_cmd)
fdf7c0
+			pr_err("Monitor using program %s\n", alert_cmd);
fdf7c0
+	}
fdf7c0
+
fdf7c0
 	info.alert_cmd = alert_cmd;
fdf7c0
 	info.mailaddr = mailaddr;
fdf7c0
 	info.mailfrom = mailfrom;
fdf7c0
-- 
fdf7c0
2.31.1
fdf7c0