[multi-asic] Fix for sonic-cfggen exception during platform string read#8229
[multi-asic] Fix for sonic-cfggen exception during platform string read#8229judyjoseph merged 2 commits intosonic-net:masterfrom
Conversation
during fresh install and start of sonic in multi asic, /var/run/redisX/ is created after database docker is started. Currently sonic-cfggen is throwing exception while reading platform string from /usr/bin/database.sh sonic python3[2259]: :- parseDatabaseConfig: Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json sonic python3[2259]: :- initializeGlobalConfig: Sonic database config file syntax error >> Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json sonic database.sh[2259]: Traceback (most recent call last): sonic database.sh[2259]: File "/usr/local/bin/sonic-cfggen", line 452, in <module> sonic database.sh[2259]: main() sonic database.sh[2259]: File "/usr/local/bin/sonic-cfggen", line 310, in main sonic database.sh[2259]: SonicDBConfig.load_sonic_global_db_config(namespace=args.namespace) sonic database.sh[2259]: File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1342, in load_sonic_global_db_config sonic database.sh[2259]: SonicDBConfig.initializeGlobalConfig(global_db_file_path) sonic database.sh[2259]: RuntimeError: Sonic database config file syntax error >> Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json sonic database.sh[2246]: Creating new database0 container sonic database.sh[2516]: 4be09b19659f7db6f8399455f32b9f7c7a47ee66f67c4d0dddf1c54fb0f9d59c sonic database.sh[3296]: database0
during fresh install and start of sonic in multi asic, /var/run/redisX/ is created after database docker is started. Currently sonic-cfggen is throwing exception while reading platform string from /usr/bin/database.sh sonic python3[2259]: :- parseDatabaseConfig: Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json sonic python3[2259]: :- initializeGlobalConfig: Sonic database config file syntax error >> Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json sonic database.sh[2259]: Traceback (most recent call last): sonic database.sh[2259]: File "/usr/local/bin/sonic-cfggen", line 452, in <module> sonic database.sh[2259]: main() sonic database.sh[2259]: File "/usr/local/bin/sonic-cfggen", line 310, in main sonic database.sh[2259]: SonicDBConfig.load_sonic_global_db_config(namespace=args.namespace) sonic database.sh[2259]: File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1342, in load_sonic_global_db_config sonic database.sh[2259]: SonicDBConfig.initializeGlobalConfig(global_db_file_path) sonic database.sh[2259]: RuntimeError: Sonic database config file syntax error >> Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json sonic database.sh[2246]: Creating new database0 container sonic database.sh[2516]: 4be09b19659f7db6f8399455f32b9f7c7a47ee66f67c4d0dddf1c54fb0f9d59c sonic database.sh[3296]: database0
|
@minionatwork. We are not hitting this issue when we bring-up a multi asic VS. Is there specific sequence of steps done to repro this issue ? adding @SuvarnaMeenakshi for viz. |
|
It was straightforward happening after first install and boot of sonic. This file is created inside docker (database docker) but to start database docker, this file is was checked and exception happens. So, I dont know how multi asic VS is working. Discussed with Judy offline. He might have more picture on this how multi asic VS is working. /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json |
Thanks to @suvarna for the multi-vs image, did a check on this error, so I see it happens there too on the first boot directly as a multi-asic VS ( earlier we didn't observe as we were booting in single ASIC mode and then converting to multi-asic VS). This is happening as we started to use swsscommon dbconnector classes and there the checks are strict and we throw runtime_error. Ref: https://github.com/Azure/sonic-swss-common/blob/f89b2ac1049c61f77b14fefc2fb0f252e1bd7aa7/common/dbconnector.cpp#L66 We will take in this fix --as this will make sure that in sonic-cfggen we load_global_config only when we pass a namespace parameter. |
judyjoseph
left a comment
There was a problem hiding this comment.
looks ok in multi-asic device too where global database config json is used.
…ad (#8229) Fix for sonic-cfggen exception during platform string read during fresh install and start of sonic in multi asic, /var/run/redisX/ is created after database docker is started.
|
Hi Judy (@judyjoseph ), I am seeing this issue on a multi asic system. My worspace is based of following commit id: |
| if args.namespace is None: | ||
| configdb = ConfigDBPipeConnector(use_unix_socket_path=True, **db_kwargs) | ||
| else: | ||
| SonicDBConfig.load_sonic_global_db_config(namespace=args.namespace) |
…ad (#8229) Fix for sonic-cfggen exception during platform string read during fresh install and start of sonic in multi asic, /var/run/redisX/ is created after database docker is started.
during fresh install and start of sonic in multi asic, /var/run/redisX/ is created after database docker is
started. Currently sonic-cfggen is throwing exception while reading platform string from /usr/bin/database.sh
sonic python3[2259]: :- parseDatabaseConfig: Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json
sonic python3[2259]: :- initializeGlobalConfig: Sonic database config file syntax error >> Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json
sonic database.sh[2259]: Traceback (most recent call last):
sonic database.sh[2259]: File "/usr/local/bin/sonic-cfggen", line 452, in
sonic database.sh[2259]: main()
sonic database.sh[2259]: File "/usr/local/bin/sonic-cfggen", line 310, in main
sonic database.sh[2259]: SonicDBConfig.load_sonic_global_db_config(namespace=args.namespace)
sonic database.sh[2259]: File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1342, in load_sonic_global_db_config
sonic database.sh[2259]: SonicDBConfig.initializeGlobalConfig(global_db_file_path)
sonic database.sh[2259]: RuntimeError: Sonic database config file syntax error >> Sonic database config file doesn't exist at /var/run/redis/sonic-db/../../redis0/sonic-db/database_config.json
sonic database.sh[2246]: Creating new database0 container
sonic database.sh[2516]: 4be09b19659f7db6f8399455f32b9f7c7a47ee66f67c4d0dddf1c54fb0f9d59c
sonic database.sh[3296]: database0
Why I did it
How I did it
How to verify it
Which release branch to backport (provide reason below if selected)
Description for the changelog
A picture of a cute animal (not mandatory but encouraged)