Deploy the 202211 image, and load the config with minigraph
execute the log analyzer.
Describe the results you received:
Could see the following err msg in the syslog
ERR python: :- initializeGlobalConfig: Sonic database config global file doesn't exist at /var/run/redis/sonic-db/database_global.json
Have debug the issue with design team, it seems the issue will happen on the non multi-asic system, but it is a statistic issue (don't understand why it is statistic)
In ansible/library/switch_capabilities_facts.py:
class SwitchCapabilityModule(object):
def __init__(self):
self.module = AnsibleModule(
argument_spec=dict(
),
supports_check_mode=True)
self.out = None
self.facts = {}
return
def run(self):
"""
Main method of the class
"""
self.facts['switch_capabilities'] = {}
namespace_list = multi_asic.get_namespace_list()
SonicDBConfig.load_sonic_global_db_config()
conn = SonicV2Connector(namespace=namespace_list[0])
conn.connect(conn.STATE_DB)
keys = conn.keys(conn.STATE_DB, 'SWITCH_CAPABILITY|*')
for key in keys:
capab = conn.get_all(conn.STATE_DB, key)
self.facts['switch_capabilities'][key.split('|')[-1]] = capab
self.module.exit_json(ansible_facts=self.facts)
but SonicDBConfig.load_sonic_global_db_config() seems could only work for the multi-asic system.
And also in the ansible/module_utils/multi_asic_utils.py, I see different implement for multi-asic and non multi-asic system:
if multi_asic.is_multi_asic():
if not swsscommon.SonicDBConfig.isGlobalInit():
swsscommon.SonicDBConfig.load_sonic_global_db_config()
else:
if not swsscommon.SonicDBConfig.isInit():
swsscommon.SonicDBConfig.load_sonic_db_config()
So maybe we also need to update the code in the ansible/library/switch_capabilities_facts.py to be applicable to both multi and non-multi asic system to aviod the issue
Here is how load_sonic_global_db_config is implemented:
void SonicDBConfig::initializeGlobalConfig(const string &file, const string &ns, const string &call_mod)
{
std::string local_file, dir_name, ns_name;
std::unordered_map<std::string, SonicDBInfo> db_entry;
std::map<std::string, RedisInstInfo> inst_entry;
std::unordered_map<int, std::string> separator_entry;
std::lock_guard<std::recursive_mutex> guard(m_db_info_mutex);
SWSS_LOG_ENTER();
SWSS_LOG_NOTICE("enter SonicDBConfig initializeGlobalConfig");
if (m_global_init)
{
SWSS_LOG_ERROR("SonicDBConfig Global config is already initialized");
return;
}
ifstream i(file);
if (i.good())
{
local_file = dir_name = std::string();
...
}
else
{
if (ns.empty())
{
SWSS_LOG_ERROR("Sonic database config global file doesn't exist at %s ns empty call mod %s", file.c_str(), call_mod.c_str());
}
else
{
SWSS_LOG_ERROR("Sonic database config global file doesn't exist at %s ns %s call mod %s\n", file.c_str(), ns.c_str(), call_mod.c_str());
}
}
// Set it as the global config file is already parsed and init done.
m_global_init = true;
}
Describe the results you expected:
No such err msg
Additional information you deem important:
**Output of `show version`:**
```
SONiC.202211_RC1.3-f75df985c_Internal
```
**Attach debug file `sudo generate_dump`:**
```
(paste your output here)
```
Description
Steps to reproduce the issue:
Describe the results you received: Could see the following err msg in the syslog ERR python: :- initializeGlobalConfig: Sonic database config global file doesn't exist at /var/run/redis/sonic-db/database_global.json
Have debug the issue with design team, it seems the issue will happen on the non multi-asic system, but it is a statistic issue (don't understand why it is statistic) In ansible/library/switch_capabilities_facts.py:
but SonicDBConfig.load_sonic_global_db_config() seems could only work for the multi-asic system.
And also in the ansible/module_utils/multi_asic_utils.py, I see different implement for multi-asic and non multi-asic system:
So maybe we also need to update the code in the ansible/library/switch_capabilities_facts.py to be applicable to both multi and non-multi asic system to aviod the issue
Here is how load_sonic_global_db_config is implemented:
Describe the results you expected: No such err msg
Additional information you deem important: