aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Marzinski <bmarzins@redhat.com>2011-12-19 15:41:57 -0600
committerChristophe Varoqui <christophe.varoqui@opensvc.com>2011-12-23 21:04:59 +0100
commitd61ed22b72ddc4de20caef2daf099e07f7777304 (patch)
tree5112d4c30c771a99a29bab2c8a8957383427510a
parentbb817e4b8c2eef12fb831a17cf935db8a1677d06 (diff)
downloadmultipath-tools-d61ed22b72ddc4de20caef2daf099e07f7777304.tar.gz
multipath: add option to change the number of error messages
This patch adds a new default config parameter, log_checker_err. It accepts two values, "once" and "always", and defaults of "always". It controls how multipathd logs checker error messages. If it's set to "once", only the first checker error message is logged at logging level 2. All future messages are logged at level 3, until the device is restored or removed. If it's set to "always", all messages are logged at level 2, like multipathd currently does. This version actually compiles. Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
-rw-r--r--libmultipath/config.h1
-rw-r--r--libmultipath/dict.c28
-rw-r--r--libmultipath/structs.h5
-rw-r--r--multipath/multipath.conf.510
-rw-r--r--multipathd/main.c8
5 files changed, 50 insertions, 2 deletions
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 6615e94..1bb2a86 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -92,6 +92,7 @@ struct config {
int attribute_flags;
int fast_io_fail;
unsigned int dev_loss;
+ int log_checker_err;
int allow_queueing;
uid_t uid;
gid_t gid;
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 514e589..6220141 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -525,6 +525,25 @@ def_flush_on_last_del_handler(vector strvec)
}
static int
+def_log_checker_err_handler(vector strvec)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ if (strlen(buff) == 4 && !strcmp(buff, "once"))
+ conf->log_checker_err = LOG_CHKR_ERR_ONCE;
+ else if (strlen(buff) == 6 && !strcmp(buff, "always"))
+ conf->log_checker_err = LOG_CHKR_ERR_ALWAYS;
+
+ free(buff);
+ return 0;
+}
+
+static int
names_handler(vector strvec)
{
char * buff;
@@ -2338,6 +2357,14 @@ snprint_def_flush_on_last_del (char * buff, int len, void * data)
}
static int
+snprint_def_log_checker_err (char * buff, int len, void * data)
+{
+ if (conf->log_checker_err == LOG_CHKR_ERR_ONCE)
+ return snprintf(buff, len, "once");
+ return snprintf(buff, len, "always");
+}
+
+static int
snprint_def_user_friendly_names (char * buff, int len, void * data)
{
if (!conf->user_friendly_names)
@@ -2428,6 +2455,7 @@ init_keywords(void)
install_keyword("fast_io_fail_tmo", &def_fast_io_fail_handler, &snprint_def_fast_io_fail);
install_keyword("dev_loss_tmo", &def_dev_loss_handler, &snprint_def_dev_loss);
install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file);
+ install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err);
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
__deprecated install_keyword("default_getuid_callout", &def_getuid_callout_handler, NULL);
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index ea0fbf3..97caa31 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -87,6 +87,11 @@ enum flush_states {
FLUSH_IN_PROGRESS,
};
+enum log_checker_err_states {
+ LOG_CHKR_ERR_ALWAYS,
+ LOG_CHKR_ERR_ONCE,
+};
+
struct scsi_idlun {
int dev_id;
int host_unique_id;
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 94adee2..aed1714 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -316,9 +316,19 @@ cannot be told to stop queueing IO. Setting queue_without_daemon to
.I no
, avoids this problem. Default is
.I yes
+.TP
.B bindings_file
The full pathname of the binding file to be used when the user_friendly_names option is set. Defaults to
.I /var/lib/multipath/bindings
+.TP
+.B log_checker_err
+If set to
+.I once
+, multipathd logs the first path checker error at logging level 2. Any later
+errors are logged at level 3 until the device is restored. If set to
+.I always
+, multipathd always logs the path checker error at logging level 2. Default is
+.I always
.
.SH "blacklist section"
The
diff --git a/multipathd/main.c b/multipathd/main.c
index 2e5fe05..3b68642 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1193,8 +1193,12 @@ check_path (struct vectors * vecs, struct path * pp)
pp->dev_t, pp->tick);
}
}
- else if (newstate == PATH_DOWN)
- LOG_MSG(2, checker_message(&pp->checker));
+ else if (newstate == PATH_DOWN) {
+ if (conf->log_checker_err == LOG_CHKR_ERR_ONCE)
+ LOG_MSG(3, checker_message(&pp->checker));
+ else
+ LOG_MSG(2, checker_message(&pp->checker));
+ }
pp->state = newstate;