Skip to content

Commit

Permalink
Added LAG member check on addLagMember() (sonic-net#2464)
Browse files Browse the repository at this point in the history
*[teammgr] Added LAG member check into addLagMember()
  • Loading branch information
Andriy Kokhan authored and yenlu-keith committed Feb 13, 2023
1 parent e0373a4 commit b94a7a6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cfgmgr/teammgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,16 +704,27 @@ task_process_status TeamMgr::addLagMember(const string &lag, const string &membe
{
SWSS_LOG_ENTER();

stringstream cmd;
string res;

// If port was already deleted, ignore this operation
cmd << IP_CMD << " link show " << shellquote(member);
if (exec(cmd.str(), res) != 0)
{
SWSS_LOG_WARN("Unable to find port %s", member.c_str());
return task_ignore;
}

// If port is already enslaved, ignore this operation
// TODO: check the current master if it is the same as to be configured
if (isPortEnslaved(member))
{
return task_ignore;
}

stringstream cmd;
string res;
uint16_t keyId = generateLacpKey(lag);
cmd.str("");
cmd.clear();

// Set admin down LAG member (required by teamd) and enslave it
// ip link set dev <member> down;
Expand Down

0 comments on commit b94a7a6

Please sign in to comment.