MINOR: srv: do not allow to track a dynamic server

Prevents the use of the "track" keyword for a dynamic server. This
simplifies the deletion of a dynamic server, without having to worry
about servers which might tracked it.

A BUG_ON is present in the dynamic server delete function to validate
this assertion.
This commit is contained in:
Amaury Denoyelle 2021-07-13 10:35:50 +02:00
parent 669b620e5f
commit 79f68be207

View File

@ -4627,6 +4627,9 @@ static int cli_parse_delete_server(char **args, char *payload, struct appctx *ap
goto out;
}
/* A dynamic server cannot be tracked. */
BUG_ON(srv->trackers);
/* Only servers in maintenance can be deleted. This ensures that the
* server is not present anymore in the lb structures (through
* lbprm.set_server_status_down).
@ -4764,6 +4767,12 @@ int srv_apply_track(struct server *srv, struct proxy *curproxy)
return 1;
}
if (strack->flags & SRV_F_DYNAMIC) {
ha_alert("unable to use %s/%s for tracking as it is a dynamic server.\n",
px->id, strack->id);
return 1;
}
if (!strack->do_check && !strack->do_agent && !strack->track &&
!strack->trackit) {
ha_alert("unable to use %s/%s for "