[dhcp6relay] Apply relay config changes at runtime without container restart#116
[dhcp6relay] Apply relay config changes at runtime without container restart#116AnantKishorSharma wants to merge 1 commit into
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@Xichen96 @yaqiangz @jcaiMR @saiarcot895 @yxieca @kellyyeh - Please review when you have a chance. This makes the SONiC-native Companion PRs:
Verification: 59/59 gtests, and on a qfx5200 t0 testbed the new sonic-mgmt tests pass in both modes (non-DualToR 4/4, DualToR |
|
Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks! ---Powered by SONiC BuildBot
|
|
/azpw retry |
|
Retrying failed(or canceled) jobs... |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
420c7a4 to
0647561
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…restart dhcp6relay read DHCP_RELAY once at startup and required a dhcp_relay container restart for any relay config change. Apply changes at runtime instead: a detached monitor thread watches CONFIG_DB/STATE_DB and the libevent main thread reconciles the live config. Signed-off-by: Anant Kishor Sharma <anant.kishor-sharma@hpe.com>
0647561 to
9036c80
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Fixes #18
Why I did it
The SONiC-native DHCPv6 relay agent (
dhcp6relay) read theDHCP_RELAYtable once at startup and required adhcp_relaycontainer restart for any subsequent relay configuration change. A container restart is disruptive: it tears down relay state for every VLAN, interrupting DHCPv6 service on all VLANs even when only a single VLAN's configuration changed.How I did it
Apply
DHCP_RELAYchanges at runtime instead of requiring a restart:config_interface.cpp) subscribes toDHCP_RELAY,VLAN_INTERFACE,VLAN(CONFIG_DB) andINTERFACE_TABLE(STATE_DB), builds the desired per-VLAN config under a mutex, and wakes the libevent main loop through a self-pipe.config_change_callback(relay.cpp), on the libevent main thread, reconciles the livevlansmap with the desired config: server-list / option changes apply in place, newly-eligible VLANs are armed via the existing link-local-readiness path, and removed VLANs are torn down. All socket and libevent work stays on the main thread; the monitor thread only reads CONFIG_DB and publishes a snapshot under a mutex.dhcp6relaynow starts unconditionally; the resulting per-packet "config not found" warnings are rate-limited (should_log_throttled).Dual ToR mode is unchanged — it is still selected by the
-uoption at startup.How to verify it
Unit tests: 59/59 gtests pass — added coverage for the reconcile (
apply_desired_config/teardown_vlan_relay/config_change_callback), the config monitor, the STATE_DB interface-readiness path, and the Dual-ToRinterface_iddefault.Hardware (qfx5200
t0, sonic-mgmttests/dhcp_relay/test_dhcpv6_relay_runtime_config.py):/usr/sbin/dhcp6relay/usr/sbin/dhcp6relay -u Loopback0Each run confirms
dhcpv6_serversadd/modify/remove and VLAN add/remove apply without a container restart (process PID unchanged) and that theneed restart container to take effectlog is no longer emitted.Companion PRs