From: Benjamin Marzinski <bmarzins@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@gmail.com>
Subject: Re: [PATCH V2] multipath: add option to change the number of error messages
Date: Mon, 19 Dec 2011 15:41:57 -0600 [thread overview]
Message-ID: <20111219214157.GO24133@ether.msp.redhat.com> (raw)
In-Reply-To: <20111219194251.GN24133@ether.msp.redhat.com>
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>
---
libmultipath/config.h | 1 +
libmultipath/dict.c | 28 ++++++++++++++++++++++++++++
libmultipath/structs.h | 5 +++++
multipath/multipath.conf.5 | 10 ++++++++++
multipathd/main.c | 8 ++++++--
5 files changed, 50 insertions(+), 2 deletions(-)
Index: multipath-tools-111219/libmultipath/config.h
===================================================================
--- multipath-tools-111219.orig/libmultipath/config.h
+++ multipath-tools-111219/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;
Index: multipath-tools-111219/libmultipath/dict.c
===================================================================
--- multipath-tools-111219.orig/libmultipath/dict.c
+++ multipath-tools-111219/libmultipath/dict.c
@@ -525,6 +525,25 @@ def_flush_on_last_del_handler(vector str
}
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 * bu
}
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);
Index: multipath-tools-111219/libmultipath/structs.h
===================================================================
--- multipath-tools-111219.orig/libmultipath/structs.h
+++ multipath-tools-111219/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;
Index: multipath-tools-111219/multipath/multipath.conf.5
===================================================================
--- multipath-tools-111219.orig/multipath/multipath.conf.5
+++ multipath-tools-111219/multipath/multipath.conf.5
@@ -316,9 +316,19 @@ cannot be told to stop queueing IO. Sett
.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
Index: multipath-tools-111219/multipathd/main.c
===================================================================
--- multipath-tools-111219.orig/multipathd/main.c
+++ multipath-tools-111219/multipathd/main.c
@@ -1193,8 +1193,12 @@ check_path (struct vectors * vecs, struc
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;
prev parent reply other threads:[~2011-12-19 21:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-19 19:42 [PATCH] multipath: add option to change the number of error messages Benjamin Marzinski
2011-12-19 21:41 ` Benjamin Marzinski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111219214157.GO24133@ether.msp.redhat.com \
--to=bmarzins@redhat.com \
--cc=christophe.varoqui@gmail.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).