Skip to content

Commit 7891e78

Browse files
authored
Fixed set mtu for deleted subintf due to late notification (#2571)
* Fixed set mtu for deleted subintf due to late notification
1 parent a443945 commit 7891e78

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

cfgmgr/intfmgr.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,19 @@ std::string IntfMgr::setHostSubIntfMtu(const string &alias, const string &mtu, c
447447
}
448448
SWSS_LOG_INFO("subintf %s active mtu: %s", alias.c_str(), subifMtu.c_str());
449449
cmd << IP_CMD " link set " << shellquote(alias) << " mtu " << shellquote(subifMtu);
450-
EXEC_WITH_ERROR_THROW(cmd.str(), res);
450+
std::string cmd_str = cmd.str();
451+
int ret = swss::exec(cmd_str, res);
451452

453+
if (ret && !isIntfStateOk(alias))
454+
{
455+
// Can happen when a SET notification on the PORT_TABLE in the State DB
456+
// followed by a new DEL notification that send by portmgrd
457+
SWSS_LOG_WARN("Setting mtu to %s netdev failed with cmd:%s, rc:%d, error:%s", alias.c_str(), cmd_str.c_str(), ret, res.c_str());
458+
}
459+
else if (ret)
460+
{
461+
throw runtime_error(cmd_str + " : " + res);
462+
}
452463
return subifMtu;
453464
}
454465

@@ -468,7 +479,7 @@ void IntfMgr::updateSubIntfAdminStatus(const string &alias, const string &admin)
468479
continue;
469480
}
470481
std::vector<FieldValueTuple> fvVector;
471-
string subintf_admin = setHostSubIntfAdminStatus(intf, m_subIntfList[intf].adminStatus, admin);
482+
string subintf_admin = setHostSubIntfAdminStatus(intf, m_subIntfList[intf].adminStatus, admin);
472483
m_subIntfList[intf].currAdminStatus = subintf_admin;
473484
FieldValueTuple fvTuple("admin_status", subintf_admin);
474485
fvVector.push_back(fvTuple);

0 commit comments

Comments
 (0)