[experimental-ims] aef8337 Use new-style backend naming in output

Geoff Simmons geoff at varnish-cache.org
Mon Jan 9 21:52:28 CET 2012


commit aef83370f8ad506dbca5b9df0494ca9b04712945
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Tue Nov 1 10:43:02 2011 +0100

    Use new-style backend naming in output
    
    Prefer vcl_name(ipv4,ipv6,port) to the old vcl_name in output.

diff --git a/bin/varnishd/cache_backend.c b/bin/varnishd/cache_backend.c
index 7bacd26..1a3ae5b 100644
--- a/bin/varnishd/cache_backend.c
+++ b/bin/varnishd/cache_backend.c
@@ -143,8 +143,8 @@ bes_conn_try(const struct sess *sp, struct vbc *vc, const struct vdi_simple *vs)
 {
 	int s;
 	struct backend *bp = vs->backend;
-	char abuf1[VTCP_ADDRBUFSIZE], abuf2[VTCP_ADDRBUFSIZE];
-	char pbuf1[VTCP_PORTBUFSIZE], pbuf2[VTCP_PORTBUFSIZE];
+	char abuf1[VTCP_ADDRBUFSIZE];
+	char pbuf1[VTCP_PORTBUFSIZE];
 
 	CHECK_OBJ_NOTNULL(vs, VDI_SIMPLE_MAGIC);
 
@@ -185,10 +185,8 @@ bes_conn_try(const struct sess *sp, struct vbc *vc, const struct vdi_simple *vs)
 	} else {
 		vc->vsl_id = s | VSL_BACKENDMARKER;
 		VTCP_myname(s, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1);
-		VTCP_name(vc->addr, vc->addrlen,
-		    abuf2, sizeof abuf2, pbuf2, sizeof pbuf2);
-		WSL(sp->wrk, SLT_BackendOpen, vc->vsl_id, "%s %s %s %s %s",
-		    vs->backend->vcl_name, abuf1, pbuf1, abuf2, pbuf2);
+		WSL(sp->wrk, SLT_BackendOpen, vc->vsl_id, "%s %s %s ",
+		    vs->backend->display_name, abuf1, pbuf1);
 	}
 
 }
@@ -347,13 +345,13 @@ vbe_GetVbe(const struct sess *sp, struct vdi_simple *vs)
 			/* XXX locking of stats */
 			VSC_C_main->backend_reuse += 1;
 			WSP(sp, SLT_Backend, "%d %s %s",
-			    vc->fd, sp->director->vcl_name, bp->vcl_name);
+			    vc->fd, sp->director->vcl_name, bp->display_name);
 			vc->vdis = vs;
 			vc->recycled = 1;
 			return (vc);
 		}
 		VSC_C_main->backend_toolate++;
-		WSL(sp->wrk, SLT_BackendClose, vc->vsl_id, "%s", bp->vcl_name);
+		WSL(sp->wrk, SLT_BackendClose, vc->vsl_id, "%s", bp->display_name);
 
 		/* Checkpoint log to flush all info related to this connection
 		   before the OS reuses the FD */
@@ -388,7 +386,7 @@ vbe_GetVbe(const struct sess *sp, struct vdi_simple *vs)
 	vc->backend = bp;
 	VSC_C_main->backend_conn++;
 	WSP(sp, SLT_Backend, "%d %s %s",
-	    vc->fd, sp->director->vcl_name, bp->vcl_name);
+	    vc->fd, sp->director->vcl_name, bp->display_name);
 	vc->vdis = vs;
 	return (vc);
 }
diff --git a/bin/varnishd/cache_backend.h b/bin/varnishd/cache_backend.h
index 47e709d..8937673 100644
--- a/bin/varnishd/cache_backend.h
+++ b/bin/varnishd/cache_backend.h
@@ -115,6 +115,7 @@ struct backend {
 	struct lock		mtx;
 
 	char			*vcl_name;
+	char			*display_name;
 	char			*ipv4_addr;
 	char			*ipv6_addr;
 	char			*port;
diff --git a/bin/varnishd/cache_backend_cfg.c b/bin/varnishd/cache_backend_cfg.c
index b10512d..a4f3285 100644
--- a/bin/varnishd/cache_backend_cfg.c
+++ b/bin/varnishd/cache_backend_cfg.c
@@ -213,6 +213,7 @@ VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb)
 	 * so we cannot simply reference the VCL's copy of things.
 	 */
 	REPLACE(b->vcl_name, vb->vcl_name);
+	REPLACE(b->display_name, buf);
 	REPLACE(b->ipv4_addr, vb->ipv4_addr);
 	REPLACE(b->ipv6_addr, vb->ipv6_addr);
 	REPLACE(b->port, vb->port);
@@ -283,9 +284,9 @@ cli_debug_backend(struct cli *cli, const char * const *av, void *priv)
 	ASSERT_CLI();
 	VTAILQ_FOREACH(b, &backends, list) {
 		CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC);
-		VCLI_Out(cli, "%p %s(%s,%s,:%s) %d %d\n",
-		    b, b->vcl_name, b->ipv4_addr, b->ipv6_addr, b->port,
-		    b->refcount, b->n_conn);
+		VCLI_Out(cli, "%p %s %d %d\n",
+			 b, b->display_name,
+			 b->refcount, b->n_conn);
 	}
 }
 
diff --git a/bin/varnishd/cache_dir.c b/bin/varnishd/cache_dir.c
index e95b015..59ef5fc 100644
--- a/bin/varnishd/cache_dir.c
+++ b/bin/varnishd/cache_dir.c
@@ -50,7 +50,7 @@ VDI_CloseFd(struct worker *wrk)
 
 	bp = wrk->vbc->backend;
 
-	WSL(wrk, SLT_BackendClose, wrk->vbc->vsl_id, "%s", bp->vcl_name);
+	WSL(wrk, SLT_BackendClose, wrk->vbc->vsl_id, "%s", bp->display_name);
 
 	/* Checkpoint log to flush all info related to this connection
 	   before the OS reuses the FD */
@@ -78,7 +78,7 @@ VDI_RecycleFd(struct worker *wrk)
 
 	bp = wrk->vbc->backend;
 
-	WSL(wrk, SLT_BackendReuse, wrk->vbc->vsl_id, "%s", bp->vcl_name);
+	WSL(wrk, SLT_BackendReuse, wrk->vbc->vsl_id, "%s", bp->display_name);
 	/*
 	 * Flush the shmlog, so that another session reusing this backend
 	 * will log chronologically later than our use of it.
diff --git a/bin/varnishd/cache_panic.c b/bin/varnishd/cache_panic.c
index 231adf1..4076d26 100644
--- a/bin/varnishd/cache_panic.c
+++ b/bin/varnishd/cache_panic.c
@@ -96,7 +96,7 @@ pan_vbc(const struct vbc *vbc)
 	be = vbc->backend;
 
 	VSB_printf(vsp, "  backend = %p fd = %d {\n", be, vbc->fd);
-	VSB_printf(vsp, "    vcl_name = \"%s\",\n", be->vcl_name);
+	VSB_printf(vsp, "    display_name = \"%s\",\n", be->display_name);
 	VSB_printf(vsp, "  },\n");
 }
 



More information about the varnish-commit mailing list