Commit adf18f4d authored by Nils Goroll's avatar Nils Goroll Committed by Poul-Henning Kamp

no implicit warmup for manual temperature control

As discussed during bugwash, we should be consistent about the manual
temperature controls and not transition cold->warm, but rather fail.
parent 424c7b85
......@@ -468,6 +468,18 @@ mgt_vcl_settemp(struct cli *cli, struct vclprog *vp, unsigned warm)
return (i);
}
static int
mgt_vcl_requirewarm(struct cli *cli, struct vclprog *vp)
{
if (vp->state == VCL_STATE_COLD) {
VCLI_SetResult(cli, CLIS_CANT);
VCLI_Out(cli, "VCL '%s' is cold - set to auto or warm first",
vp->name);
return (1);
}
return (mgt_vcl_settemp(cli, vp, 1));
}
static int
mgt_vcl_tellchild(struct cli *cli, struct vclprog *vp, unsigned warm)
{
......@@ -783,7 +795,7 @@ mcf_vcl_use(struct cli *cli, const char * const *av, void *priv)
if (vp == active_vcl)
return;
if (mgt_vcl_settemp(cli, vp, 1))
if (mgt_vcl_requirewarm(cli, vp))
return;
if (MCH_Running() &&
......@@ -999,10 +1011,13 @@ mcf_vcl_label(struct cli *cli, const char * const *av, void *priv)
}
}
if (mgt_vcl_settemp(cli, vpt, 1))
if (mgt_vcl_requirewarm(cli, vpt))
return;
if (vpl != NULL) {
/* potentially fail before we delete the dependency */
if (mgt_vcl_requirewarm(cli, vpl))
return;
mgt_vcl_dep_del(VTAILQ_FIRST(&vpl->dfrom));
AN(VTAILQ_EMPTY(&vpl->dfrom));
} else {
......@@ -1010,7 +1025,7 @@ mcf_vcl_label(struct cli *cli, const char * const *av, void *priv)
}
AN(vpl);
if (mgt_vcl_settemp(cli, vpl, 1))
if (mgt_vcl_requirewarm(cli, vpl))
return;
mgt_vcl_dep_add(vpl, vpt);
......
......@@ -48,7 +48,10 @@ varnish v1 -cliexpect "available *cold *cold *[0-9]+ *vcl1\\s+active *auto *warm
delay .4
varnish v1 -expect !VBE.vcl1.default.happy
# Use it, and it should come warm (but not auto)
# Manual temperature control needs to be explicit before use
varnish v1 -clierr 300 "vcl.use vcl1"
varnish v1 -cliok "vcl.state vcl1 warm"
varnish v1 -cliok "vcl.use vcl1"
varnish v1 -cliexpect "active *warm *warm *[0-9]+ *vcl1\\s+available *auto *warm *[0-9]+ *vcl2" "vcl.list"
delay .4
......
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