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

[portsorch] Avoid orchagent crash when set invalid interface types to port #1906

Merged
merged 4 commits into from
Sep 20, 2021

Conversation

Junchao-Mellanox
Copy link
Collaborator

@Junchao-Mellanox Junchao-Mellanox commented Sep 15, 2021

What I did

When setting invalid interface types to port, do not call handleSaiSetStatus to avoid orchagent exit.

Why I did it

Currently, when setting invalid interface types to port, orchagent would crash, this is not necessary since user still has chance to correct it. Error log see:

Jun  1 03:35:22.172518 r-leopard-41 ERR swss#orchagent: :- set: set status: SAI_STATUS_INVALID_ATTR_VALUE_0
Jun  1 03:35:22.172518 r-leopard-41 ERR swss#orchagent: :- handleSaiSetStatus: Encountered failure in set operation, exiting orchagent, SAI API: SAI_API_PORT, status: SAI_STATUS_INVALID_ATTR_VALUE_0

How I verified it

Manual test

Details if related

orchagent/portsorch.cpp Show resolved Hide resolved
@@ -2836,7 +2844,7 @@ void PortsOrch::doPortTask(Consumer &consumer)
else
{
SWSS_LOG_ERROR("Failed to set port %s AN from %d to %d", alias.c_str(), p.m_autoneg, an);
it++;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to make this change?

@@ -2872,7 +2880,7 @@ void PortsOrch::doPortTask(Consumer &consumer)
if (!setPortSpeed(p, speed))
{
SWSS_LOG_ERROR("Failed to set port %s speed from %u to %u", alias.c_str(), p.m_speed, speed);
it++;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to make this change?

@@ -2920,7 +2928,7 @@ void PortsOrch::doPortTask(Consumer &consumer)
SWSS_LOG_ERROR("Failed to set port %s advertised speed from %s to %s", alias.c_str(),
ori_adv_speeds.c_str(),
adv_speeds_str.c_str());
it++;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to make this change?

@@ -2960,7 +2968,7 @@ void PortsOrch::doPortTask(Consumer &consumer)
if (!setPortInterfaceType(p.m_port_id, interface_type))
{
SWSS_LOG_ERROR("Failed to set port %s interface type to %s", alias.c_str(), interface_type_str.c_str());
it++;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to make this change?

@@ -2999,7 +3007,7 @@ void PortsOrch::doPortTask(Consumer &consumer)
if (!setPortAdvInterfaceTypes(p.m_port_id, adv_interface_types))
{
SWSS_LOG_ERROR("Failed to set port %s advertised interface type to %s", alias.c_str(), adv_interface_types_str.c_str());
it++;
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the reason to make this change is to avoid retrying. However, I think the problem is we typically treat false return value as need retry and this behavior deviate from the expected one. I am not sure what would be the best solution, I think a reasonable one could be making the return value type of setPortAdvInterfaceTypes to task_process_status. And adding the status of SAI_STATUS_INVALID_ATTR_VALUE_0 for SAI_API_PORT as a special case to return task_failed in the failure handling function like #1815. Then we can make the return value of task_process_status type from handleSaiSetStatus as the return value of setPortAdvInterfaceTypes in case of SAI failure. It follows that we can choose whether to retry here.

@Junchao-Mellanox Junchao-Mellanox marked this pull request as draft September 17, 2021 02:58
@Junchao-Mellanox Junchao-Mellanox marked this pull request as ready for review September 17, 2021 05:19
@Junchao-Mellanox
Copy link
Collaborator Author

@shi-su I have fixed all comments, could you please review again?

@Junchao-Mellanox
Copy link
Collaborator Author

The test failure is not related to the PR.

Copy link
Contributor

@shi-su shi-su left a comment

Choose a reason for hiding this comment

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

Could you please include the error message related to the changes in the PR description?

@Junchao-Mellanox
Copy link
Collaborator Author

Updated description with error message

@shi-su shi-su merged commit 86b4ede into sonic-net:master Sep 20, 2021
@Junchao-Mellanox
Copy link
Collaborator Author

Hi @judyjoseph, could you help cherry-pick to 202106?

judyjoseph pushed a commit that referenced this pull request Sep 27, 2021
… port (#1906)

What I did

When setting invalid interface types to port, do not call handleSaiSetStatus to avoid orchagent exit.

Why I did it

Currently, when setting invalid interface types to port, orchagent would crash, this is not necessary since user still has chance to correct it
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
… port (sonic-net#1906)

What I did

When setting invalid interface types to port, do not call handleSaiSetStatus to avoid orchagent exit.

Why I did it

Currently, when setting invalid interface types to port, orchagent would crash, this is not necessary since user still has chance to correct it
@Junchao-Mellanox Junchao-Mellanox deleted the wa-autoneg branch October 29, 2021 01:44
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
What I did
get_port_config was modified to return different set number of arguments in PR: sonic-net/sonic-buildimage#4222. Changes in this PR is:

To address the different set of return values
To get the ports from all namespaces
To add unit-test
How I did it
Modify port2alias to read ports from all namespaces and also add unit-test

How to verify it
Test on single and multi-asic platforms.
unit-test passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants