-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Use unix socket path in ConfigDBConnector for some components #10179
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
Closed
stepanblyschak
wants to merge
4
commits into
sonic-net:master
from
stepanblyschak:use_unix_socket_path
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
89fa106
Use unix socket path in ConfigDBConnector for some components
stepanblyschak aefff93
Another place added where unix sock usage is required
stepanblyschak 78eee06
add another use_unix_socket_path
stepanblyschak 8a79393
add param for connect_configdb_for_ns
stepanblyschak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a library function, it will impact many applications. One impact that the new code requires
sudo
for the application.To make migration easier, how about add a parameter to
connect_config_db_for_ns()
and by default do not use unix socket. And you can migrate the applications one by one. #ClosedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qiluo-msft In my test use_unix_socket_path does not require sudo:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Still application may still want to customize the connection method. Could you add a parameter to connect_config_db_for_ns() and by default do not use unix socket. And you can migrate the applications one by one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qiluo-msft In some cases it is not possible to do. Considering an application want's to import from a library:
This will connect to DB using TCP. But the question is, how an application doing import needs to tell the library to use unix socket. One may add a boolean flag before doing import but this is a hack which might not work actually when the import is done from another place. I don't think executing much code like connecting to a database during import time is correct for general purpose sonic library. So I would need to refactor that part, which is actually a bit of work in an area which I do not have the right expertise (chassis, multi-asic, etc.). A similar story for the multi_asic.py.
Considering that I don't see a problem using unix socket now (the sudo is no more required) I would prefer to change the default in the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify: I am asking adding a parameter to
connect_config_db_for_ns()
, notget_platform_info()
.I agree with you on the case study of
get_platform_info()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qiluo-msft I see, only for connect_config_db_for_ns it is possible. I fixed that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double checked and there should be permission issue. Only checked swsssdk library. But swsscommon should be the same. Make sure you could not read the file
/var/run/redis/redis.sock
. So the suggestion is to keep the library behave the old way if there is no explicit option.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qiluo-msft what is your SONiC version ?