MINOR: proxy: prevent backend deletion if server still exists in it

Ensure a backend instance cannot be removed if there is still server in
it. This is checked via be_check_for_deletion() to ensure "del backend"
cannot be executed. The only solution is to use "del server" to remove
on the servers instances.

This check only covers servers not yet targetted via "del server". For
deleted servers not yet purged (due to their refcount), the proxy
refcount is incremented but this does not block "del backend"
invokation.
This commit is contained in:
Amaury Denoyelle 2026-01-12 15:26:45 +01:00
parent 7f725f0754
commit 053887cc98
2 changed files with 7 additions and 1 deletions

View File

@ -2128,7 +2128,8 @@ del backend <name>
Removes the backend proxy with the name <name>.
This operation is only possible for TCP or HTTP proxies. To succeed, the
backend instance must have been first unpublished.
backend instance must have been first unpublished. Also, all of its servers
must first be removed (via "del server" CLI).
There is additional restrictions which prevent backend removal. First, a
backend cannot be removed if it is explicitely referenced by config elements,

View File

@ -5048,6 +5048,11 @@ int be_check_for_deletion(const char *bename, struct proxy **pb, const char **pm
goto out;
}
if (be->srv) {
msg = "Only a backend without server can be deleted.";
goto out;
}
/* Second, conditions that may change over time */
ret = 0;