[kea-dev] Suggestion for new hooks: server startup, shutdown, reload

Tomek Mrugalski tomasz at isc.org
Mon Dec 1 15:57:11 UTC 2014


On 19.11.2014 17:04, Chaigneau, Nicolas wrote:
> I think it could be extended with new hook points. What do you think of the following proposal ?
> 
> - "server startup" hook:
> Triggered after server has been started, configuration read, subnets initialized, leases loaded from backend; and just before the server actually starts processing DHCP packets.
> This would allow a hook library to:
> - Read its configuration (if it has one)
> - Perform the initialization steps it requires
> - If something wrong happens it could report through an output error code, which would cause the server to stop (as when the main configuration is incorrect, for instance).
> 
> The hook should provide access to anything the hook library needs.
> For my needs, I can think of the subnets collection and the leases collection. The list is open though.
> 
> - "server shutdown" hook:
> Triggered just before the server is about to be shut down.
> This would give a hook library a chance to perform some termination steps, if need be. Close handles, etc.
> (although on Linux it's not strictly needed, it's still cleaner to do so).
Both are useful, if you haven't done so, please submit a ticket and
describe your proposal. (Apologies if you already did that. I just
returned from 2 weeks vacation and I'm not entirely up to speed). We'll
process it the usual way - review on a team call on Wednesday and assign
it to a milestone.

> - "library reload" hook:
> Triggered after the hook library is reloaded (after the server has processed the "libreload" command)
> I think the same possibilities as in "server startup" should be provided.
Does it make sense? For a library, the libreload should be
indistinguishable from server shutdown and startup events, i.e. a
library is unloaded and later loaded again. So I don't see any useful
way to trigger such hook. If you need to know whether the library is
loaded upon startup or as a result of libreload, we could possibly add
an argument to load() that would signal that.

So, do you really need this? If yes, would an argument passed to load do
the trick?

Tomek



More information about the kea-dev mailing list