2021-09-22 18:05:03 -05:00
|
|
|
[group:dhcp-relay]
|
[dhcp_relay] Use dhcprelayd to manage critical processes (#17236)
Modify j2 template files in docker-dhcp-relay. Add dhcprelayd to group dhcp-relay instead of isc-dhcp-relay-VlanXXX, which would make dhcprelayd to become critical process.
In dhcprelayd, subscribe FEATURE table to check whether dhcp_server feature is enabled.
2.1 If dhcp_server feature is disabled, means we need original dhcp_relay functionality, dhcprelayd would do nothing. Because dhcrelay/dhcpmon configuration is generated in supervisord configuration, they will automatically run.
2.2 If dhcp_server feature is enabled, dhcprelayd will stop dhcpmon/dhcrelay processes started by supervisord and subscribe dhcp_server related tables in config_db to start dhcpmon/dhcrelay processes.
2.3 While dhcprelayd running, it will regularly check feature status (by default per 5s) and would encounter below 4 state change about dhcp_server feature:
A) disabled -> enabled
In this scenario, dhcprelayd will subscribe dhcp_server related tables and stop dhcpmon/dhcrelay processes started by supervisord and start new pair of dhcpmon/dhcrelay processes. After this, dhcpmon/dhcrelay processes are totally managed by dhcprelayd.
B) enabled -> enabled
In this scenaro, dhcprelayd will monitor db changes in dhcp_server related tables to determine whether to restart dhcpmon/dhrelay processes.
C) enabled -> disabled
In this scenario, dhcprelayd would unsubscribe dhcp_server related tables and kill dhcpmon/dhcrelay processes started by itself. And then dhcprelayd will start dhcpmon/dhcrelay processes via supervisorctl.
D) disabled -> disabled
dhcprelayd will check whether dhcrelay processes running status consistent with supervisord configuration file. If they are not consistent, dhcprelayd will kill itself, then dhcp_relay container will stop because dhcprelayd is critical process.
2023-11-27 11:30:01 -06:00
|
|
|
programs=dhcprelayd,
|
2022-06-04 13:37:04 -05:00
|
|
|
{%- set relay_for_ipv6 = { 'flag': False } %}
|
2021-07-16 09:31:05 -05:00
|
|
|
{%- set add_preceding_comma = { 'flag': False } %}
|
2023-11-02 10:09:01 -05:00
|
|
|
{% if dhcp_server_ipv4_enabled %}
|
|
|
|
{%- endif %}
|
2021-07-16 09:31:05 -05:00
|
|
|
{% for vlan_name in VLAN_INTERFACE %}
|
2022-06-04 13:37:04 -05:00
|
|
|
{% if DHCP_RELAY and vlan_name in DHCP_RELAY and DHCP_RELAY[vlan_name]['dhcpv6_servers']|length > 0 %}
|
|
|
|
{% set _dummy = relay_for_ipv6.update({'flag': True}) %}
|
|
|
|
{%- endif %}
|
|
|
|
{% endfor %}
|
2021-07-16 09:31:05 -05:00
|
|
|
{# Append DHCPv6 agents #}
|
2022-06-04 13:37:04 -05:00
|
|
|
{% if relay_for_ipv6.flag %}
|
2021-07-16 09:31:05 -05:00
|
|
|
{% if add_preceding_comma.flag %},{% endif %}
|
|
|
|
{% set _dummy = add_preceding_comma.update({'flag': True}) %}
|
2021-09-22 18:05:03 -05:00
|
|
|
dhcp6relay
|
2022-06-04 13:37:04 -05:00
|
|
|
{% endif %}
|