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

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