This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
sonic-buildimage/files/scripts
Vaibhav Hemant Dixit 908933bd8c
[202012] Fix CONFIG_DB_INITIALIZED flag check logic and set/reset flag for warmboot (#16225)
Cherry pick of #15685

MSFT ADO: 24274591

#### Why I did it

Two changes:
### 1  Fix a day1 issue, where check to wait until `CONFIG_DB_INITIALIZED` is incorrect.
There are multiple places where same incorrect logic is used.

Current logic (`until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]];`) will always result in pass, irrespective of the result of GET operation.
```
root@str2-7060cx-32s-29:~# sonic-db-cli CONFIG_DB GET "CONFIG_DB_INITIALIZED"
1
root@str2-7060cx-32s-29:~# until [[ $(sonic-db-cli CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]]; do echo "entered here"; done
root@str2-7060cx-32s-29:~# 

root@str2-7060cx-32s-29:~# 
root@str2-7060cx-32s-29:~# sonic-db-cli CONFIG_DB GET "CONFIG_DB_INITIALIZED"                                             
0
root@str2-7060cx-32s-29:~# until [[ $(sonic-db-cli CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]]; do echo "entered here"; done
root@str2-7060cx-32s-29:~# 
```

Fix this logic by checking for value of flag to be "1".
```
root@str2-7060cx-32s-29:~# until [[ $(sonic-db-cli CONFIG_DB GET "CONFIG_DB_INITIALIZED") -eq 1 ]]; do echo "entered here"; done
entered here
entered here
entered here
```

This gap in logic was highlighted when another fix was merged: https://github.com/sonic-net/sonic-buildimage/pull/14933
The issue being fixed here caused warmboot-finalizer to not wait until config-db is initialized.

### 2 Set and unset CONFIG_DB_INITIALIZED for warm-reboot case

Currently, during warm shutdown `CONFIG_DB_INITIALIZED`'s value is stored in redis db backup. This is restored back when the dump is loaded during warm-recovery.
So the value of `CONFIG_DB_INITIALIZED` does not depend on config db's state, however it remain what it was before reboot.

Fix this by setting `CONFIG_DB_INITIALIZED` to 0 as when the DB is loaded, and set it to 1 after db_migrator is done.
2023-08-24 11:48:56 -07:00
..
arp_update Resolve neighbors from config_db (#14990) 2023-05-17 16:13:54 -07:00
bgp.sh BGP Service script path and error fix (#5183) 2020-08-15 12:09:10 -07:00
configdb-load.sh [MultiDB] use sonic-db-cli PING and fix wrong multiDB API in NAT (#4541) 2020-05-06 15:41:28 -07:00
core_cleanup.py [Python] Align files in root dir, dockers/ and files/ with PEP8 standards (#6109) 2020-12-03 15:57:50 -08:00
database.sh [services] kill container on stop in warm/fast mode (#10511) 2022-04-18 14:27:48 -07:00
gbsyncd.sh Add gearbox phy device files and a new physyncd docker to support VS gearbox phy feature (#4851) 2020-09-25 08:32:44 -07:00
mark_dhcp_packet.py [mux]: Fix mark_dhcp_packet (#9373) 2021-12-01 02:28:56 +00:00
mgmt-framework.sh [services] kill container on stop in warm/fast mode (#10511) 2022-04-18 14:27:48 -07:00
radv.sh [services] kill container on stop in warm/fast mode (#10511) 2022-04-18 14:27:48 -07:00
service_mgmt.sh [services] kill container on stop in warm/fast mode (#10511) 2022-04-18 14:27:48 -07:00
snmp.sh [services] kill container on stop in warm/fast mode (#10511) 2022-04-18 14:27:48 -07:00
sonic-netns-exec [sonic-netns-exec]: use "$@" to reflects all positional parameters as they were set initially (#4375) 2020-04-07 00:05:47 -07:00
supervisor-proc-exit-listener [Supervisord] Deduplicate the alerting messages of critical processes from Supervisord. (#6849) 2021-03-04 21:23:05 +00:00
swss.sh [202012] Fix CONFIG_DB_INITIALIZED flag check logic and set/reset flag for warmboot (#16225) 2023-08-24 11:48:56 -07:00
syncd_common.sh [202012] Fix CONFIG_DB_INITIALIZED flag check logic and set/reset flag for warmboot (#16225) 2023-08-24 11:48:56 -07:00
syncd.sh [202012] [Mellanox] [pmon] Fix for PMON service not starting when restarting SWSS service after fast/warm reboot (#10902) 2022-06-08 09:46:54 +03:00
teamd.sh [teamd.sh] kill teamd docker on warm shutdown for faster shutdown (#10219) 2022-03-16 22:22:26 +00:00
telemetry.sh [services] kill container on stop in warm/fast mode (#10511) 2022-04-18 14:27:48 -07:00
update_chassisdb_config In modular chassis, add CHASSIS_STATE_DB on control card (#5624) 2020-12-15 17:15:00 -08:00
write_standby.py [mux] skip mux operations during warm shutdown (#11937) 2022-10-03 22:30:55 +00:00