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

[multi-asic][cli][chassis-db] Avoid connecting to chassis db for cli commands executed from linecard #1707

Merged
merged 2 commits into from Oct 12, 2021

Conversation

vganesan-nokia
Copy link
Contributor

What I did

Currently, for all the cli commands, we connect to all databases mentioned in the database_config.json. The database_config.json also includes the databases from chassis redis server from supervisor card. It is unneccessary to connect to databases from chassis redis server when cli commands are executed form linecard. But we need to allow connection to chassis databases when the cli commands are executed from supervisor card. This problem is fixed by this PR

How I did it

The constructor of Db() class which is instantiated for every CLI command execution is changed to skip chassis databases from the list of collected databases if the card is not supervisor card. This PR is dependent on sonic-buildimage PR sonic-net/sonic-buildimage#8065.

How to verify it

In voq chassis execute some CLI commands (show, config, etc.) and make sure that commands are executed without any CLI errors no matter whether there is supervisor card or not.

Previous command output (if the output of a command-line utility has changed)

No command syntax or outputs changed

New command output (if the output of a command-line utility has changed)

N/A

@anshuv-mfst
Copy link

Hi @mlorrillere - could you please review, thanks.

mlorrillere
mlorrillere previously approved these changes Jul 12, 2021
db_list = list(self.db.get_db_list())
if not device_info.is_supervisor():
try:
db_list.remove('CHASSIS_APP_DB')
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment, we can have a function in py_common/multi_asic.py or py_common/deviceinfo to get the list of chassis db instances and use here. Will help in future when we add more DBs

@judyjoseph
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@judyjoseph
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vganesan-nokia
Copy link
Contributor Author

@judyjoseph, would you please re-start the azure pipeline again? The build is still not picking up the dependednt changes from sonic-net/sonic-buildimage#8065. Thanks

@judyjoseph
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

vedganes added 2 commits October 4, 2021 10:05
Currently, for all the cli commands, we connect to all databases
mentioned in the database_config.json. The database_config.json also
includes the databases from chassis redis server from supervisor card.
It is unneccessary to connect to databases from chassis redis server
when cli commands are executed form linecard. But we need to allow
connection to chassis databases when the cli commands are executed from
supervisor card.

The changes in this PR fixes this problem. The constructor of Db() class
which is instantiated for every CLI command execution is changed to skip
chassis databases from the list of collected databases if the card is not
supervisor card.

Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
is_voq_supervisor() renamed to is_supervisor() as this API is applicable
for non VOQ chassis also.

Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
@judyjoseph judyjoseph merged commit 476b3a4 into sonic-net:master Oct 12, 2021
judyjoseph pushed a commit that referenced this pull request Oct 14, 2021
…commands executed from linecard (#1707)

* [multi-asic][cli][chassis-db] Avoid connecting to chassis db

Currently, for all the cli commands, we connect to all databases
mentioned in the database_config.json. The database_config.json also
includes the databases from chassis redis server from supervisor card.
It is unneccessary to connect to databases from chassis redis server
when cli commands are executed form linecard. But we need to allow
connection to chassis databases when the cli commands are executed from
supervisor card.

The changes in this PR fixes this problem. The constructor of Db() class
which is instantiated for every CLI command execution is changed to skip
chassis databases from the list of collected databases if the card is not
supervisor card.

Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
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.

None yet

4 participants