]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proxy: parse guid on dynamic backend creation
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 13 Jan 2026 15:13:27 +0000 (16:13 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 6 Feb 2026 16:28:04 +0000 (17:28 +0100)
Defines an extra optional GUID argument for "add backend" command. This
can be useful as it is not possible to define it via a default proxy
instance.

doc/management.txt
src/proxy.c

index 43eed45076a60387588aeda29d8e4b6b6a75e38b..5a256a8e714d0b2c8dcbdb472cdb486fffc9ebc0 100644 (file)
@@ -1725,13 +1725,14 @@ add acl [@<ver>] <acl> <pattern>
   This command cannot be used if the reference <acl> is a name also used with
   a map. In this case, the "add map" command must be used instead.
 
-add backend <name> from <defproxy> [mode <mode>] [ EXPERIMENTAL ]
+add backend <name> from <defproxy> [mode <mode>] [guid <guid>] [ EXPERIMENTAL ]
   Instantiate a new backend proxy with the name <name>.
 
   Only TCP or HTTP proxies can be created. All of the settings are inherited
   from <defproxy> default proxy instance. By default, it is mandatory to
   specify the backend mode via the argument of the same name, unless <defproxy>
-  already defines it explicitely.
+  already defines it explicitely. It is also possible to use an optional GUID
+  argument if wanted.
 
   Servers can be added via the command "add server". The backend is initialized
   in the unpublished state. Once considered ready for traffic, use "publish
index 43651b51570b18c94a3c309d2115d969e1b7594e..eeed469b5f0073f13d10315817d6496b3204af94 100644 (file)
@@ -4787,7 +4787,7 @@ static int cli_parse_shutdown_frontend(char **args, char *payload, struct appctx
 static int cli_parse_add_backend(char **args, char *payload, struct appctx *appctx, void *private)
 {
        struct proxy *px, *defpx;
-       const char *be_name, *def_name, *err;
+       const char *be_name, *def_name, *guid = NULL, *err;
        char *msg = NULL;
        enum pr_mode mode = 0;
 
@@ -4829,9 +4829,13 @@ static int cli_parse_add_backend(char **args, char *payload, struct appctx *appc
                                return 1;
                        }
                }
+               /* guid */
+               else if (*args[2] && !guid && strcmp(args[1], "guid") == 0) {
+                       guid = args[2];
+               }
                /* unknown, malformed or duplicate argument */
                else {
-                       cli_err(appctx, "Usage: add backend <name> from <defproxy> [mode <px_mode>].\n");
+                       cli_err(appctx, "Usage: add backend <name> from <defproxy> [mode <px_mode>] [guid <val>].\n");
                        return 1;
                }