]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: new global section directive: server-state-file
authorBaptiste Assmann <bedis9@gmail.com>
Sun, 23 Aug 2015 07:54:31 +0000 (09:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 19 Sep 2015 15:05:27 +0000 (17:05 +0200)
This new global section directive is used to store the path to the file
where HAProxy will be able to retrieve server states across reloads.

The file pointed by this path is used to store a file which can contains
state of all servers from all backends.

include/types/global.h
src/cfgparse.c

index fe1085e95921e8480c6579f637feae5a1e8ba259..2039e42d128aee3b3fe8c95dd964596cbf4811ca 100644 (file)
@@ -130,6 +130,7 @@ struct global {
        struct list logsrvs;
        char *log_send_hostname;   /* set hostname in syslog header */
        char *server_state_base;   /* path to a directory where server state files can be found */
+       char *server_state_file;   /* path to the file where server states are loaded from */
        struct {
                int maxpollevents; /* max number of poll events at once */
                int maxaccept;     /* max number of consecutive accept() */
index d3ee13260ac97b1251017612538d3006711f9ec9..c711b2bf1a39e79c95487521257a3ac25a25fabf 100644 (file)
@@ -1660,6 +1660,21 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
 
                global.server_state_base = strdup(args[1]);
        }
+       else if (!strcmp(args[0], "server-state-file")) { /* path to the file where HAProxy can load the server states */
+               if (global.server_state_file != NULL) {
+                       Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
+                       err_code |= ERR_ALERT;
+                       goto out;
+               }
+
+               if (!*(args[1])) {
+                       Alert("parsing [%s:%d] : '%s' expect one argument: a file path.\n", file, linenum, args[0]);
+                       err_code |= ERR_FATAL;
+                       goto out;
+               }
+
+               global.server_state_file = strdup(args[1]);
+       }
        else if (!strcmp(args[0], "log-tag")) {  /* tag to report to syslog */
                if (alertif_too_many_args(1, file, linenum, args, &err_code))
                        goto out;