Skip to content
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

[teamd]: Clean teamd process if LAG creation fails #2888

Merged
merged 9 commits into from
Sep 13, 2023
3 changes: 0 additions & 3 deletions cfgmgr/teammgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,6 @@ bool TeamMgr::removeLag(const string &alias)
string res;
pid_t pid;

cmd << TEAMD_CMD << " -k -t " << shellquote(alias);
EXEC_WITH_ERROR_THROW(cmd.str(), res);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, can I suggest to the following:

bool TeamMgr::removeLag(const string &alias, bool assertSuccess)
{
...
if (asserSuccess) {
    EXEC_WITH_ERROR_THROW(cmd.str(), res);
} else {
    exec( cmd.str(), res );
}
   ...
}

In the case when the addLag() fails, removeLag() will be called with assertSuccess=false, otherwise the code path stays the same. IMO this would address the issue while still keeping the addLag() and removeLag() symmetrical... my 2cents.

try
{
std::stringstream cmd;
Expand Down