Add 'max_polling_interval' config variable
authorHannes Reinecke <hare@suse.de>
Mon, 1 Feb 2010 08:46:57 +0000 (09:46 +0100)
committerHannes Reinecke <hare@suse.de>
Wed, 4 May 2011 07:59:05 +0000 (09:59 +0200)
We should be able to set the 'max_polling_interval' variable
manually. Especially systems requiring precise failover timing
will want to disable the automatic polling interval increase.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/dict.c
multipath/multipath.conf.5
multipathd/main.c

index 299ec82..07aa9d0 100644 (file)
@@ -76,6 +76,17 @@ verbosity_handler(vector strvec)
        return 0;
 }
 
        return 0;
 }
 
+static int
+max_polling_interval_handler(vector strvec)
+{
+       char *buff;
+
+       buff = VECTOR_SLOT(strvec, 1);
+       conf->max_checkint = atoi(buff);
+
+       return 0;
+}
+
 static int
 udev_dir_handler(vector strvec)
 {
 static int
 udev_dir_handler(vector strvec)
 {
@@ -1976,6 +1987,14 @@ snprint_def_verbosity (char * buff, int len, void * data)
        return snprintf(buff, len, "%i", conf->verbosity);
 }
 
        return snprintf(buff, len, "%i", conf->verbosity);
 }
 
+static int
+snprint_def_max_polling_interval (char * buff, int len, void * data)
+{
+       if (conf->max_checkint == MAX_CHECKINT(conf->checkint))
+               return 0;
+       return snprintf(buff, len, "%i", conf->max_checkint);
+}
+
 static int
 snprint_def_udev_dir (char * buff, int len, void * data)
 {
 static int
 snprint_def_udev_dir (char * buff, int len, void * data)
 {
@@ -2259,6 +2278,7 @@ 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_root("defaults", NULL);
        install_keyword("verbosity", &verbosity_handler, &snprint_def_verbosity);
        install_keyword("polling_interval", &polling_interval_handler, &snprint_def_polling_interval);
+       install_keyword("max_polling_interval", &max_polling_interval_handler, &snprint_def_max_polling_interval);
        install_keyword("udev_dir", &udev_dir_handler, &snprint_def_udev_dir);
        install_keyword("multipath_dir", &multipath_dir_handler, &snprint_def_multipath_dir);
        install_keyword("path_selector", &def_selector_handler, &snprint_def_selector);
        install_keyword("udev_dir", &udev_dir_handler, &snprint_def_udev_dir);
        install_keyword("multipath_dir", &multipath_dir_handler, &snprint_def_multipath_dir);
        install_keyword("path_selector", &def_selector_handler, &snprint_def_selector);
index 43a0c27..cfc67fd 100644 (file)
@@ -68,11 +68,16 @@ The
 section recognizes the following keywords:
 .TP 17
 .B polling_interval
 section recognizes the following keywords:
 .TP 17
 .B polling_interval
-interval between two path checks in seconds For properly functioning paths,
-the interval between checks will gradually increase to (4 * polling_interval);
+interval between two path checks in seconds. For properly functioning paths,
+the interval between checks will gradually increase to
+.B max_polling_interval;
 default is
 .I 5
 .TP
 default is
 .I 5
 .TP
+.B max_polling_interval
+maximal interval between two path checks in seconds; default is
+.I 4 * polling_interval
+.TP
 .B udev_dir
 directory where udev creates its device nodes; default is
 .I /dev
 .B udev_dir
 directory where udev creates its device nodes; default is
 .I /dev
index 1723ddc..71d2bb3 100644 (file)
@@ -1060,18 +1060,20 @@ check_path (struct vectors * vecs, struct path * pp)
        }
        else if (newstate == PATH_UP || newstate == PATH_GHOST) {
                LOG_MSG(4, checker_message(&pp->checker));
        }
        else if (newstate == PATH_UP || newstate == PATH_GHOST) {
                LOG_MSG(4, checker_message(&pp->checker));
-               /*
-                * double the next check delay.
-                * max at conf->max_checkint
-                */
-               if (pp->checkint < (conf->max_checkint / 2))
-                       pp->checkint = 2 * pp->checkint;
-               else
-                       pp->checkint = conf->max_checkint;
+               if (pp->checkint != conf->max_checkint) {
+                       /*
+                        * double the next check delay.
+                        * max at conf->max_checkint
+                        */
+                       if (pp->checkint < (conf->max_checkint / 2))
+                               pp->checkint = 2 * pp->checkint;
+                       else
+                               pp->checkint = conf->max_checkint;
 
 
-               pp->tick = pp->checkint;
-               condlog(4, "%s: delay next check %is",
+                       pp->tick = pp->checkint;
+                       condlog(4, "%s: delay next check %is",
                                pp->dev_t, pp->tick);
                                pp->dev_t, pp->tick);
+               }
        }
        else if (newstate == PATH_DOWN)
                LOG_MSG(2, checker_message(&pp->checker));
        }
        else if (newstate == PATH_DOWN)
                LOG_MSG(2, checker_message(&pp->checker));