[master] 2c47803ec shard: VRT_fail for backend add/remove errors

Nils Goroll nils.goroll at uplex.de
Wed Jun 10 07:42:06 UTC 2020


commit 2c47803ec0d5eb4a687577881f04a160c62965e1
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Jun 10 09:14:49 2020 +0200

    shard: VRT_fail for backend add/remove errors
    
    ... to be more in line with other bundled directors

diff --git a/lib/libvmod_directors/vmod_shard.c b/lib/libvmod_directors/vmod_shard.c
index 8a8bda9a2..3f0444f4c 100644
--- a/lib/libvmod_directors/vmod_shard.c
+++ b/lib/libvmod_directors/vmod_shard.c
@@ -310,8 +310,8 @@ vmod_shard_add_backend(VRT_CTX, struct vmod_directors_shard *vshard,
 	CHECK_OBJ_NOTNULL(vshard, VMOD_SHARD_SHARD_MAGIC);
 
 	if (args->backend == NULL) {
-		shard_err0(ctx, vshard->shardd,
-		    ".backend_add() NULL backend given");
+		VRT_fail(ctx, "%s: NULL backend cannot be added",
+			 vshard->shardd->name);
 		return (0);
 	}
 
@@ -335,10 +335,10 @@ vmod_shard_remove_backend(VRT_CTX, struct vmod_directors_shard *vshard,
 	CHECK_OBJ_NOTNULL(vshard, VMOD_SHARD_SHARD_MAGIC);
 
 	if (be == NULL && ident == NULL) {
-		shard_err0(ctx, vshard->shardd,
-		    ".backend_remove() at least one of backend "
-		    "and ident must be given");
-		return 0;
+		VRT_fail(ctx, "%s.backend_remove(): "
+		    "either backend or ident are required",
+		    vshard->shardd->name);
+		return (0);
 	}
 
 	return shardcfg_remove_backend(ctx, args->arg1, vshard->shardd,


More information about the varnish-commit mailing list