From 8e191fd33fd131061dc762cd45bf54088713a6ff Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 14 Oct 2008 08:21:02 +0200 Subject: [PATCH] Read the verbosity level from multipath.conf configuration file With this patch, multipathd can read the verbosity level from the multipath.conf configuration file. For example: verbosity 5 References: 388284 Signed-off-by: Ritesh Raj Sarraf Signed-off-by: Hannes Reinecke --- libmultipath/config.c | 2 +- libmultipath/defaults.h | 1 + libmultipath/dict.c | 20 ++++++++++++++++++++ multipath/multipath.conf.5 | 5 +++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/libmultipath/config.c b/libmultipath/config.c index b0d8b4a..cd7ed0f 100644 --- a/libmultipath/config.c +++ b/libmultipath/config.c @@ -431,7 +431,7 @@ load_config (char * file) * internal defaults */ if (!conf->verbosity) - conf->verbosity = 2; + conf->verbosity = DEFAULT_VERBOSITY; conf->dev_type = DEV_NONE; conf->minio = 1000; diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h index d7f93cb..49d2227 100644 --- a/libmultipath/defaults.h +++ b/libmultipath/defaults.h @@ -11,6 +11,7 @@ #define DEFAULT_NO_PATH_RETRY NO_PATH_RETRY_UNDEF #define DEFAULT_PGTIMEOUT -PGTIMEOUT_NONE #define DEFAULT_USER_FRIENDLY_NAMES 0 +#define DEFAULT_VERBOSITY 2 #define DEFAULT_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) diff --git a/libmultipath/dict.c b/libmultipath/dict.c index fc8516b..aa350f4 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -33,6 +33,17 @@ polling_interval_handler(vector strvec) } static int +verbosity_handler(vector strvec) +{ + char * buff; + + buff = VECTOR_SLOT(strvec, 1); + conf->verbosity = atoi(buff); + + return 0; +} + +static int udev_dir_handler(vector strvec) { conf->udev_dir = set_value(strvec); @@ -1418,6 +1429,14 @@ snprint_def_polling_interval (char * buff, int len, void * data) } static int +snprint_def_verbosity (char * buff, int len, void * data) +{ + if (conf->checkint == DEFAULT_VERBOSITY) + return 0; + return snprintf(buff, len, "%i", conf->verbosity); +} + +static int snprint_def_udev_dir (char * buff, int len, void * data) { if (!conf->udev_dir) @@ -1663,6 +1682,7 @@ void init_keywords(void) { install_keyword_root("defaults", NULL); + install_keyword("verbosity", &verbosity_handler, &snprint_def_verbosity); install_keyword("polling_interval", &polling_interval_handler, &snprint_def_polling_interval); install_keyword("udev_dir", &udev_dir_handler, &snprint_def_udev_dir); install_keyword("multipath_dir", &multipath_dir_handler, &snprint_def_multipath_dir); diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index 057dd83..6b1be81 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -74,6 +74,11 @@ interval between two path checks in seconds; default is directory where udev creates its device nodes; default is .I /dev .TP +.B verbosity +default verbosity. Higher values increase the verbosity level. Valid +levels are between 0 and 6; default is 2. +.I /dev +.TP .B selector The default path selector algorithm to use; they are offered by the kernel multipath target. The only currently implemented is -- 2.7.4