From dbcaaf8aa27b37dfba1b088e2fa59fd94b8dc683 Mon Sep 17 00:00:00 2001 From: Yaqiang Zhu Date: Mon, 12 Jun 2023 09:49:41 +0800 Subject: [PATCH] [dhcp-relay] Fix dhcp6relay counter issue (#2866) Why I did While deleting a Vlan, clear dhcpv6_relay counter info state_db before dhcp_relay container restart would cause that counter info still exist in state_db, which is incorrect. Microsoft ADO number: 24211173 How I did it Clear counter info in state_db after container restart. How to verify it Previous ut and build image to verify. Signed-off-by: Yaqiang Zhu --- config/vlan.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/vlan.py b/config/vlan.py index ec4b269cc2..03660ab0af 100644 --- a/config/vlan.py +++ b/config/vlan.py @@ -118,15 +118,14 @@ def del_vlan(db, vid, no_restart_dhcp_relay): # set dhcpv4_relay table set_dhcp_relay_table('VLAN', config_db, vlan, None) - delete_state_db_entry(vlan) - if not no_restart_dhcp_relay and is_dhcpv6_relay_config_exist(db, vlan): # set dhcpv6_relay table set_dhcp_relay_table('DHCP_RELAY', config_db, vlan, None) # We need to restart dhcp_relay service after dhcpv6_relay config change if is_dhcp_relay_running(): dhcp_relay_util.handle_restart_dhcp_relay_service() - + delete_state_db_entry(vlan) + vlans = db.cfgdb.get_keys('VLAN') if not vlans: docker_exec_cmd = "docker exec -i swss {}"