Skip to content

Fix db_migrator to copy missing values from INIT_CFG to config_db#1209

Merged
prsunny merged 1 commit intosonic-net:masterfrom
vaibhavhd:warm-reboot-upgrade-fix
Nov 6, 2020
Merged

Fix db_migrator to copy missing values from INIT_CFG to config_db#1209
prsunny merged 1 commit intosonic-net:masterfrom
vaibhavhd:warm-reboot-upgrade-fix

Conversation

@vaibhavhd
Copy link
Copy Markdown
Contributor

- What I did
Proposed fix for missing FEATURE table during warm-upgrade from 201811to 201911.
Fixes: sonic-net/sonic-buildimage#5738

FEATURE table is a part of 201911 image database, but absent in 201811 images. The warm upgrade from 201811 image to 201911 image fails as the feature table is missing in the DB and multiple errors are seen in syslog.

This PR fixes DB_MIGRATOR code to update missing init_cfg tables into config_db.

- How I did it
Iterate through the tables in /etc/sonic/init_cfg.json, if a table is found missing in configDB, update the configDB with the missing table. Otherwise, ignore it, so to avoid overriding configDB tables with init_cfg.

- How to verify it
Error is easily reproducible. Manually tested the fix by modifying db_migrator and issuing the migrate command.
The result is that the FEATURE table is updated in the in memory database and show feature status command starts displaying these features.

root@sonic-device:~# show feature status
Feature    State    AutoRestart
---------  -------  -------------
root@sonic-device:~#
root@sonic-device:~# db_migrator.py -o migrate
root@sonic-device:~#
root@sonic-device:/etc/sonic# show feature status
Feature     State    AutoRestart
----------  -------  -------------
acms        enabled  enabled
bgp         enabled  enabled
database    enabled  disabled
dhcp_relay  enabled  enabled
lldp        enabled  enabled
pmon        enabled  enabled
radv        enabled  enabled
snmp        enabled  enabled
swss        enabled  enabled
syncd       enabled  enabled
teamd       enabled  enabled
telemetry   enabled  enabled
root@sonic-device:/etc/sonic# 

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

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

@vaibhavhd vaibhavhd requested review from prsunny and yxieca November 3, 2020 08:15
@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Nov 3, 2020

This pull request introduces 1 alert when merging 85508bf into ef5f212 - view on LGTM.com

new alerts:

  • 1 for Unused import

@prsunny
Copy link
Copy Markdown
Contributor

prsunny commented Nov 5, 2020

looks ok to me... @yxieca , @abdosi for visibility as this changes the config_db entries during warmboot.

@prsunny prsunny requested a review from abdosi November 5, 2020 01:16
@yxieca
Copy link
Copy Markdown
Contributor

yxieca commented Nov 5, 2020

looks ok to me... @yxieca , @abdosi for visibility as this changes the config_db entries during warmboot.

@prsunny I think we discussed needing something like this somewhere else. Forgot which PR now.

@prsunny
Copy link
Copy Markdown
Contributor

prsunny commented Nov 6, 2020

looks ok to me... @yxieca , @abdosi for visibility as this changes the config_db entries during warmboot.

@prsunny I think we discussed needing something like this somewhere else. Forgot which PR now.

Thats right @yxieca , we discussed for this PR #1004. I mentioned this PR to
dgsudharsan and he shall modify his PR based on this change.

@vaibhavhd
Copy link
Copy Markdown
Contributor Author

@abdosi can we please cherry pick this for 201911 branch too?

@abdosi
Copy link
Copy Markdown
Contributor

abdosi commented Mar 15, 2021

@vaibhavhd can we create PR for 201911.

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.

DB_MIGRATOR misses FEATURE table during warm upgrade from 201811 to 201911

4 participants