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

Allow buffer profile apply after init #1099

Merged
merged 6 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions orchagent/bufferorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,19 @@ task_process_status BufferOrch::processQueue(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("Queue profile '%s' was inserted after BufferOrch init", key.c_str());
// If a buffer queue profile is not in the initial CONFIG_DB BUFFER_QUEUE table
// at BufferOrch object instantiation, it is considered being applied
// at run time, and, in this case, is not tracked in the m_ready_list. It is up to
// the application to guarantee the set order that the buffer queue profile
// should be applied to a physical port before the physical port is brought up to
// carry traffic. Here, we alert to application through syslog when such a wrong
// set order is detected.
for (const auto &port_name : port_names)
{
if (gPortsOrch->isPortAdminUp(port_name)) {
SWSS_LOG_ERROR("Queue profile '%s' applied after port %s is up", key.c_str(), port_name.c_str());
}
}
}

return task_process_status::task_success;
Expand Down Expand Up @@ -666,7 +678,19 @@ task_process_status BufferOrch::processPriorityGroup(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("PG profile '%s' was inserted after BufferOrch init", key.c_str());
// If a buffer pg profile is not in the initial CONFIG_DB BUFFER_PG table
// at BufferOrch object instantiation, it is considered being applied
// at run time, and, in this case, is not tracked in the m_ready_list. It is up to
// the application to guarantee the set order that the buffer pg profile
// should be applied to a physical port before the physical port is brought up to
// carry traffic. Here, we alert to application through syslog when such a wrong
// set order is detected.
for (const auto &port_name : port_names)
{
if (gPortsOrch->isPortAdminUp(port_name)) {
SWSS_LOG_ERROR("PG profile '%s' applied after port %s is up", key.c_str(), port_name.c_str());
}
}
}

return task_process_status::task_success;
Expand Down
11 changes: 11 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,17 @@ bool PortsOrch::isInitDone()
return m_initDone;
}

bool PortsOrch::isPortAdminUp(const string &alias)
{
auto it = m_portList.find(alias);
if (it == m_portList.end())
{
SWSS_LOG_ERROR("Failed to get Port object by port alias: %s", alias.c_str());
return false;
}

return it->second.m_admin_state_up;
}

map<string, Port>& PortsOrch::getAllPorts()
{
Expand Down
1 change: 1 addition & 0 deletions orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class PortsOrch : public Orch, public Subject

bool allPortsReady();
bool isInitDone();
bool isPortAdminUp(const string &alias);

map<string, Port>& getAllPorts();
bool bake() override;
Expand Down
1 change: 0 additions & 1 deletion portsyncd/portsyncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}


return 1;
}

Expand Down