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.
diff --git a/src/server.c b/src/server.c
index 1ad4c2e..664e2f4 100644
--- a/src/server.c
+++ b/src/server.c
@@ -4627,6 +4627,9 @@
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 @@
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 "