Commit 51723332 authored by Nils Goroll's avatar Nils Goroll

add resolve=CLD

parent ebfb59a8
......@@ -28,6 +28,7 @@ AM_VTC_LOG_FLAGS = \
TESTS = \
vtc/cfg.vtc \
vtc/cld.vtc \
vtc/deep.vtc \
vtc/deep_stk.vtc \
vtc/direct.vtc \
......
VMODENUM(LAZY)
VMODENUM(SHALLOW)
VMODENUM(DEEP)
VMODENUM(CLD)
#undef VMODENUM
......@@ -435,6 +435,7 @@ real_resolve(VRT_CTX, VCL_BACKEND r, enum resolve_e resolve)
{
switch (resolve) {
case SHALLOW:
case CLD:
return (r);
case DEEP:
return (VRT_DirectorResolve(ctx, r));
......@@ -463,6 +464,7 @@ cluster_resolve(VRT_CTX,
switch (resolve) {
case SHALLOW:
return (pr->cluster);
case CLD:
case DEEP:
return (r);
default:
......
......@@ -187,7 +187,7 @@ Return the current `direct` value as set with :ref:`func_cluster.get_direct`.
See :ref:`meth_ctx` for limitations.
$Method BACKEND .backend(ENUM {LAZY, SHALLOW, DEEP} resolve=LAZY,
$Method BACKEND .backend(ENUM {LAZY, SHALLOW, DEEP, CLD} resolve=LAZY,
[ BACKEND deny ], [ BACKEND real ],
[ BOOL uncacheable_direct ])
......@@ -205,6 +205,10 @@ documentation:
`real` backend resolve to. Only differs from ``resolve=SHALLOW`` for
director backends.
* for ``resolve=CLD`` (read "cluster deep") the actual backend as if
`cluster` was selected with ``resolve=DEEP`` and a reference to the
`real` backend otherwise.
The optional `deny`, `real` and `uncacheable_direct` arguments behave
differently depending on context:
......
varnishtest "test resolve=CLD"
varnish v1 -vcl {
import cluster;
import directors;
backend s1 { .host = "${bad_backend}";}
backend s2 { .host = "${bad_backend}";}
backend s3 { .host = "${bad_backend}";}
sub vcl_init {
new rr = directors.round_robin();
rr.add_backend(s1);
rr.add_backend(s2);
new real = directors.round_robin();
real.add_backend(s3);
new cl = cluster.cluster(rr.backend(), deny=s2, real=real.backend());
}
sub vcl_recv {
return (synth(200));
}
sub vcl_synth {
set resp.http.b1 = cl.backend(resolve=CLD);
set resp.http.b2 = cl.backend(resolve=CLD);
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.http.b1 == s1
expect resp.http.b2 == real
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment