Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

load_db_config before connecting to ConfigDBConnector in portconfig.py #11361

Closed

Conversation

nathcohe
Copy link
Contributor

@nathcohe nathcohe commented Jul 6, 2022

Why I did it

Running commands like sfputil show presence would cause the following error:

validateNamespace: Initialize global DB config using API SonicDBConfig::initializeGlobalConfig 

A similar issue was already fixed for show commands upstream:

sonic-net/sonic-utilities#1752

How I did it

Imported and used the load_db_config() function from utilities_common.general.

How to verify it

Running:

sfputil show presence

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205

Description for the changelog

Adds call to load_db_config() before connecting to the ConfigDBConnector in portconfig.py

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

🐿

@nathcohe nathcohe requested a review from a team as a code owner July 6, 2022 16:53
@SuvarnaMeenakshi
Copy link
Contributor

@nathcohe load_db_config() was removed from portconfig.py because it portconfi is a library and load_db_config() should be done by application. So it was moved to sonic-cfggen which is using portconfig.py functions.
The issue that you are seeing is reported in this issue: #11269
The latest sonic master branch image should no longer see this issue.
Can you please confirm with latest master branch and close this PR.

@nathcohe
Copy link
Contributor Author

nathcohe commented Jul 6, 2022

@SuvarnaMeenakshi, even with the change
sonic-net/sonic-utilities#2238

we still hit the following:

root@sfd-t2-lc0:/home/cisco# sfputil show presence
Error reading port info (:- validateNamespace: Initialize global DB config using API SonicDBConfig::initializeGlobalConfig)

Are there any other changes that went in recently that might have fixed the above CLI?

@SuvarnaMeenakshi
Copy link
Contributor

SuvarnaMeenakshi commented Jul 6, 2022

@SuvarnaMeenakshi, even with the change Azure/sonic-utilities#2238

we still hit the following:

root@sfd-t2-lc0:/home/cisco# sfputil show presence
Error reading port info (:- validateNamespace: Initialize global DB config using API SonicDBConfig::initializeGlobalConfig)

Are there any other changes that went in recently that might have fixed the above CLI?

Not that I know of, can you check if "pfcwd start_default" works ?
The issue that we initially saw was load_minigraph failing because of "pfcwd start_default" failure.

@SuvarnaMeenakshi
Copy link
Contributor

@SuvarnaMeenakshi, even with the change Azure/sonic-utilities#2238
we still hit the following:

root@sfd-t2-lc0:/home/cisco# sfputil show presence
Error reading port info (:- validateNamespace: Initialize global DB config using API SonicDBConfig::initializeGlobalConfig)

Are there any other changes that went in recently that might have fixed the above CLI?

Not that I know of, can you check if "pfcwd start_default" works ? The issue that we initially saw was load_minigraph failing because of "pfcwd start_default" failure.

@SuvarnaMeenakshi, even with the change Azure/sonic-utilities#2238
we still hit the following:

root@sfd-t2-lc0:/home/cisco# sfputil show presence
Error reading port info (:- validateNamespace: Initialize global DB config using API SonicDBConfig::initializeGlobalConfig)

Are there any other changes that went in recently that might have fixed the above CLI?

Not that I know of, can you check if "pfcwd start_default" works ? The issue that we initially saw was load_minigraph failing because of "pfcwd start_default" failure.

Discussed with @arlakshm Similar sonic-net/sonic-utilities#2238 should be made in the sfputil cli implementation in sonic-utilities.

@qiluo-msft qiluo-msft requested a review from liuh-80 July 6, 2022 19:13
@nathcohe
Copy link
Contributor Author

nathcohe commented Jul 7, 2022

Could we try re-running the GitHub checks or have them looked at? I am unable to view the build issue.

@SuvarnaMeenakshi
Copy link
Contributor

ng the GitHub checks or have them looked at? I am unable to view the build issue.
Seems like the sonic-config-engine unit tests are failing. re-running might not resolve the issue seen here.
I have copied one of the failures.
This is not the right fix in portconfig.py, the fix should be made in sonic-utilities

======================================================================
ERROR: test_var_json_data (tests.test_cfggen.TestCfgGen)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/sonic/src/sonic-config-engine/tests/test_cfggen.py", line 152, in test_var_json_data
   output = self.run_script(argument)
 File "/sonic/src/sonic-config-engine/tests/test_cfggen.py", line 60, in run_script
   output = subprocess.check_output(self.script_file + ' ' + argument, shell=True)
 File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
   raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command 'python2 /sonic/src/sonic-config-engine/tests/../sonic-cfggen -m "/sonic/src/sonic-config-engine/tests/simple-sample-graph.xml" -p "/sonic/src/sonic-config-engine/tests/t0-sample-port-config.ini" --var-json VLAN_MEMBER' returned non-zero exit status 1

@nathcohe nathcohe closed this Jul 27, 2022
@nathcohe nathcohe deleted the port_config_load_db_config branch July 27, 2022 20:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants