[CLI][Multi ASIC] Allow commands that don't support "-n" option to be run with "sudo ip netns.." option.#5446
Merged
smaheshm merged 1 commit intosonic-net:masterfrom Sep 24, 2020
Merged
Conversation
Contributor
Author
|
NOTE: CLI commands that support "-n" option will still give an error when run with "sudo ip netns exec ... " option. This behavior is intended to encourage users to use "-n" option. |
abdosi
approved these changes
Sep 23, 2020
Contributor
|
Dont' see "Which release branch to backport (provide reason below if selected)" marked? Is this PR needed for backporting to 201911? |
Contributor
Author
I selected and saved, not sure why it didn't save. |
Contributor
Author
|
retest vsimage please |
abdosi
pushed a commit
that referenced
this pull request
Sep 28, 2020
santhosh-kt
pushed a commit
to santhosh-kt/sonic-buildimage
that referenced
this pull request
Feb 25, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- Why I did it
In multi ASIC platforms, CLIs commands can be under a namespace using the following command, which is now broken.
NOTE: CLI commands that support "-n" option will still give an error when run with "sudo ip netns exec ... " option. This behavior is intended to encourage users to use "-n" option.
The preferred way of running a CLI command for a namespace is using "-n" option of the CLI command. At this point not all 'show' CLIs have the support of specifying "-n" option. "sudo ip netns exec asicX" is the only way run a command for a namespace.
- How I did it
The command was failing as it was trying to connect to DB in different namespace. Made change so that get namespace API returns the current namespace if it is run under a non default namespace.
- How to verify it
Verified manually on multi ASIC platform.
Before:
After:
- Which release branch to backport (provide reason below if selected)
- Description for the changelog
Update get_all_linux_namespaces() API to return the current namespace
- A picture of a cute animal (not mandatory but encouraged)