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

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