From f21f91a99917ce0c36a47f1f17b102e6de29e9ef Mon Sep 17 00:00:00 2001 From: abdosi <58047199+abdosi@users.noreply.github.com> Date: Thu, 17 Oct 2024 17:44:12 -0700 Subject: [PATCH 1/5] Update values_store.cpp --- tlm_teamd/values_store.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tlm_teamd/values_store.cpp b/tlm_teamd/values_store.cpp index f883d22fd3..a955d36be7 100644 --- a/tlm_teamd/values_store.cpp +++ b/tlm_teamd/values_store.cpp @@ -366,7 +366,13 @@ void ValuesStore::update(const std::vector & dumps) { const auto & storage = from_json(dumps); const auto & old_keys = get_old_keys(storage); - remove_keys_db(old_keys); + // Do not delete te key from State Db. State DB LAB_TABLE entry is created/deleted + // from teamsyncd on detecting netlink of teamd dev as up/down. For some reason + // if we do not get state dump from teamdctl it might be transient issue. If it is + // persistent issue then teamsyncd might be able to catch it and delete state db entry + // or we can keep entry in it's current state as best effort. Similar to try_add_lag which is best effort + // to connect to teamdctl and if it fails we do not delete State Db entry. + //remove_keys_db(old_keys); remove_keys_storage(old_keys); const auto & keys_to_refresh = update_storage(storage); update_db(storage, keys_to_refresh); From f609c8da8c08b36008507d9050bafa5a09b9e0ee Mon Sep 17 00:00:00 2001 From: abdosi <58047199+abdosi@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:49:32 -0700 Subject: [PATCH 2/5] Update values_store.cpp --- tlm_teamd/values_store.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tlm_teamd/values_store.cpp b/tlm_teamd/values_store.cpp index a955d36be7..957194b4c5 100644 --- a/tlm_teamd/values_store.cpp +++ b/tlm_teamd/values_store.cpp @@ -281,6 +281,14 @@ void ValuesStore::remove_keys_db(const std::vector & keys) const auto & p = split_key(key); const auto & table_name = p.first; const auto & table_key = p.second; + // Do not delete te key from State Db for table LAB_TABLE. LAB_TABLE entry is created/deleted + // from teamsyncd on detecting netlink of teamd dev as up/down. For some reason + // if we do not get state dump from teamdctl it might be transient issue. If it is + // persistent issue then teamsyncd might be able to catch it and delete state db entry + // or we can keep entry in it's current state as best effort. Similar to try_add_lag which is best effort + // to connect to teamdctl and if it fails we do not delete State Db entry. + if (table_name == "LAG_TABLE") + continue; swss::Table table(m_db, table_name); table.del(table_key); } @@ -366,13 +374,7 @@ void ValuesStore::update(const std::vector & dumps) { const auto & storage = from_json(dumps); const auto & old_keys = get_old_keys(storage); - // Do not delete te key from State Db. State DB LAB_TABLE entry is created/deleted - // from teamsyncd on detecting netlink of teamd dev as up/down. For some reason - // if we do not get state dump from teamdctl it might be transient issue. If it is - // persistent issue then teamsyncd might be able to catch it and delete state db entry - // or we can keep entry in it's current state as best effort. Similar to try_add_lag which is best effort - // to connect to teamdctl and if it fails we do not delete State Db entry. - //remove_keys_db(old_keys); + remove_keys_db(old_keys); remove_keys_storage(old_keys); const auto & keys_to_refresh = update_storage(storage); update_db(storage, keys_to_refresh); From adff6c4080668bc78f6fb7efba4b597250f241d9 Mon Sep 17 00:00:00 2001 From: abdosi <58047199+abdosi@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:56:23 -0700 Subject: [PATCH 3/5] Update values_store.cpp --- tlm_teamd/values_store.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tlm_teamd/values_store.cpp b/tlm_teamd/values_store.cpp index 015ed62524..957194b4c5 100644 --- a/tlm_teamd/values_store.cpp +++ b/tlm_teamd/values_store.cpp @@ -374,13 +374,7 @@ void ValuesStore::update(const std::vector & dumps) { const auto & storage = from_json(dumps); const auto & old_keys = get_old_keys(storage); - // Do not delete te key from State Db. State DB LAB_TABLE entry is created/deleted - // from teamsyncd on detecting netlink of teamd dev as up/down. For some reason - // if we do not get state dump from teamdctl it might be transient issue. If it is - // persistent issue then teamsyncd might be able to catch it and delete state db entry - // or we can keep entry in it's current state as best effort. Similar to try_add_lag which is best effort - // to connect to teamdctl and if it fails we do not delete State Db entry. - //remove_keys_db(old_keys); + remove_keys_db(old_keys); remove_keys_storage(old_keys); const auto & keys_to_refresh = update_storage(storage); update_db(storage, keys_to_refresh); From 1e247e9e3a64e57c79a9d8824f276e9fbe050e45 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Thu, 7 Nov 2024 00:32:26 +0000 Subject: [PATCH 4/5] Fix the issue race condition where portchannel might get deleted and we try to add it vlan as member in kernel. Signed-off-by: Abhishek Dosi --- cfgmgr/vlanmgr.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cfgmgr/vlanmgr.cpp b/cfgmgr/vlanmgr.cpp index c23a23cf14..9ea917a5b5 100644 --- a/cfgmgr/vlanmgr.cpp +++ b/cfgmgr/vlanmgr.cpp @@ -221,7 +221,17 @@ bool VlanMgr::addHostVlanMember(int vlan_id, const string &port_alias, const str cmds << BASH_CMD " -c " << shellquote(inner.str()); std::string res; - EXEC_WITH_ERROR_THROW(cmds.str(), res); + try + { + EXEC_WITH_ERROR_THROW(cmds.str(), res); + } + catch (const std::runtime_error& e) + { + if (!isMemberStateOk(port_alias)) + return false; + else + throw; + } return true; } @@ -632,6 +642,12 @@ void VlanMgr::doVlanMemberTask(Consumer &consumer) m_vlanMemberReplay.erase(kfvKey(t)); } + else + { + SWSS_LOG_INFO("Netdevice for %s not ready, delaying", kfvKey(t).c_str()); + it++; + continue; + } } else if (op == DEL_COMMAND) { From a9c32487b28d0146727b3bc3b2654a6f976a7d85 Mon Sep 17 00:00:00 2001 From: abdosi <58047199+abdosi@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:39:38 -0800 Subject: [PATCH 5/5] Update vlanmgr.cpp --- cfgmgr/vlanmgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfgmgr/vlanmgr.cpp b/cfgmgr/vlanmgr.cpp index 9ea917a5b5..5e1c823982 100644 --- a/cfgmgr/vlanmgr.cpp +++ b/cfgmgr/vlanmgr.cpp @@ -230,7 +230,7 @@ bool VlanMgr::addHostVlanMember(int vlan_id, const string &port_alias, const str if (!isMemberStateOk(port_alias)) return false; else - throw; + EXEC_WITH_ERROR_THROW(cmds.str(), res); } return true;