-
Notifications
You must be signed in to change notification settings - Fork 582
vlanmgr changes related to EVPN VxLan warmboot #1460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
d40b538
92b3d2e
4d0931a
9c9d797
5edb7a3
53abc67
961827b
5569d66
d714132
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,12 +29,32 @@ VlanMgr::VlanMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, c | |
m_stateVlanTable(stateDb, STATE_VLAN_TABLE_NAME), | ||
m_stateVlanMemberTable(stateDb, STATE_VLAN_MEMBER_TABLE_NAME), | ||
m_appVlanTableProducer(appDb, APP_VLAN_TABLE_NAME), | ||
m_appVlanMemberTableProducer(appDb, APP_VLAN_MEMBER_TABLE_NAME) | ||
m_appVlanMemberTableProducer(appDb, APP_VLAN_MEMBER_TABLE_NAME), | ||
replayDone(false) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (WarmStart::isWarmStart()) | ||
{ | ||
vector<string> vlanKeys, vlanMemberKeys; | ||
|
||
/* cache all vlan and vlan member config */ | ||
m_cfgVlanTable.getKeys(vlanKeys); | ||
m_cfgVlanMemberTable.getKeys(vlanMemberKeys); | ||
for (auto k : vlanKeys) | ||
{ | ||
m_vlanReplay.insert(k); | ||
} | ||
for (auto k : vlanMemberKeys) | ||
{ | ||
m_vlanMemberReplay.insert(k); | ||
} | ||
if (m_vlanReplay.empty()) | ||
{ | ||
replayDone = true; | ||
WarmStart::setWarmStartState("vlanmgrd", WarmStart::REPLAYED); | ||
SWSS_LOG_NOTICE("vlanmgr warmstart state set to REPLAYED"); | ||
} | ||
const std::string cmds = std::string("") | ||
+ IP_CMD + " link show " + DOT1Q_BRIDGE_NAME + " 2>/dev/null"; | ||
|
||
|
@@ -298,6 +318,7 @@ void VlanMgr::doVlanTask(Consumer &consumer) | |
if (isVlanStateOk(key) && m_vlans.find(key) == m_vlans.end()) | ||
{ | ||
m_vlans.insert(key); | ||
m_vlanReplay.erase(kfvKey(t)); | ||
it = consumer.m_toSync.erase(it); | ||
SWSS_LOG_DEBUG("%s already created", kfvKey(t).c_str()); | ||
continue; | ||
|
@@ -308,6 +329,7 @@ void VlanMgr::doVlanTask(Consumer &consumer) | |
{ | ||
addHostVlan(vlan_id); | ||
} | ||
m_vlanReplay.erase(kfvKey(t)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The same #Closed |
||
|
||
/* set up host env .... */ | ||
for (auto i : kfvFieldsValues(t)) | ||
|
@@ -394,6 +416,14 @@ void VlanMgr::doVlanTask(Consumer &consumer) | |
it = consumer.m_toSync.erase(it); | ||
} | ||
} | ||
if (!replayDone && m_vlanReplay.empty() && | ||
m_vlanMemberReplay.empty() && | ||
WarmStart::isWarmStart()) | ||
{ | ||
replayDone = true; | ||
WarmStart::setWarmStartState("vlanmgrd", WarmStart::REPLAYED); | ||
SWSS_LOG_NOTICE("vlanmgr warmstart state set to REPLAYED"); | ||
} | ||
} | ||
|
||
bool VlanMgr::isMemberStateOk(const string &alias) | ||
|
@@ -536,6 +566,7 @@ void VlanMgr::doVlanMemberTask(Consumer &consumer) | |
if (isVlanMemberStateOk(kfvKey(t))) | ||
{ | ||
SWSS_LOG_DEBUG("%s already set", kfvKey(t).c_str()); | ||
m_vlanMemberReplay.erase(kfvKey(t)); | ||
it = consumer.m_toSync.erase(it); | ||
continue; | ||
} | ||
|
@@ -577,6 +608,8 @@ void VlanMgr::doVlanMemberTask(Consumer &consumer) | |
FieldValueTuple s("state", "ok"); | ||
fvVector.push_back(s); | ||
m_stateVlanMemberTable.set(kfvKey(t), fvVector); | ||
|
||
m_vlanMemberReplay.erase(kfvKey(t)); | ||
} | ||
} | ||
else if (op == DEL_COMMAND) | ||
|
@@ -603,6 +636,13 @@ void VlanMgr::doVlanMemberTask(Consumer &consumer) | |
/* Other than the case of member port/lag is not ready, no retry will be performed */ | ||
it = consumer.m_toSync.erase(it); | ||
} | ||
if (!replayDone && m_vlanMemberReplay.empty() && | ||
WarmStart::isWarmStart()) | ||
{ | ||
replayDone = true; | ||
WarmStart::setWarmStartState("vlanmgrd", WarmStart::REPLAYED); | ||
SWSS_LOG_NOTICE("vlanmgr warmstart state set to REPLAYED"); | ||
} | ||
} | ||
|
||
void VlanMgr::doTask(Consumer &consumer) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -437,7 +437,8 @@ def test_VlanMgrdWarmRestart(self, dvs, testlog): | |
(status, fvs) = tbl.get("Vlan20:11.0.0.11") | ||
assert status == True | ||
|
||
swss_app_check_RestoreCount_single(state_db, restore_count, "vlanmgrd") | ||
swss_check_RestoreCount(dvs, state_db, restore_count) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @qiluo-msft , could you review this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lgtm There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there are more dependencies on the Reconciled state in the vs tests, I will check and fix. |
||
swss_app_check_warmstart_state(state_db, "vlanmgrd", "replayed") | ||
|
||
intf_tbl._del("Vlan16|11.0.0.1/29") | ||
intf_tbl._del("Vlan20|11.0.0.9/29") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
erase#Closedit
directly?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qiluo-msft sorry, I didn't understand, here I am erasing the key from the set m_vlanReplay, what do you mean by erase 'it' directly?