Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

After first bootup, the FEATURE table is not present in CONFIG_DB #5911

Merged
merged 1 commit into from
Jan 5, 2021

Conversation

AkhileshSamineni
Copy link
Contributor

Issue : After first bootup, the FEATURE table is not present in CONFIG_DB

root@sonic:/home/admin# sonic-db-cli CONFIG_DB keys *FEAT*

root@sonic:/home/admin#

(With Fix from PR - sonic-net/sonic-utilities#1232)
root@sonic:/home/admin# config feature state nat enabled
Feature 'nat' doesn't exist
root@sonic:/home/admin#

And then, If I do 'cold reboot' or 'config reload', the FEATURE table gets added to CONFIG_DB.

After reboot/config-reload,

root@sonic:/home/admin# sonic-db-cli CONFIG_DB keys *FEAT*
FEATURE|nat
FEATURE|bgp
FEATURE|syncd
FEATURE|sflow
FEATURE|telemetry
FEATURE|snmp
FEATURE|pmon
FEATURE|swss
FEATURE|mgmt-framework
FEATURE|database
FEATURE|radv
FEATURE|lldp
FEATURE|teamd
FEATURE|dhcp_relay
root@sonic:/home/admin#

Rootcause:

While first boot up, the init_cfg.json file (contains FEATURE table) contents are not getting written to CONFIG_DB.
And later 'cold reboot' or 'config reload', init_cfg.json file contents are writing to CONFIG_DB.

Fix : Added changes to do "config reload" instead of "load config" in config-setup script, as it handles the config_db contents at first bootup.
'config reload' script takes care of writing 'init_cfg.json' file to CONFIG_DB.

Signed-off-by: Akhilesh Samineni akhilesh.samineni@broadcom.com

Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
@AkhileshSamineni
Copy link
Contributor Author

@jleveque @lguohan Please review the changes.

@abdosi
Copy link
Contributor

abdosi commented Dec 23, 2020

@AkhileshSamineni what is the sequence for this issue to come ? Below file always make sure Feature Table is there in config db

https://github.com/Azure/sonic-buildimage/blob/master/files/build_templates/init_cfg.json.j2

@AkhileshSamineni
Copy link
Contributor Author

@AkhileshSamineni what is the sequence for this issue to come ? Below file always make sure Feature Table is there in config db

https://github.com/Azure/sonic-buildimage/blob/master/files/build_templates/init_cfg.json.j2

@abdosi
Issue is seen when we do "onie-install" (first boot-up).
The "FEATURE" table is present in below file, but it doesn't make sure that the "FEATURE" table is written to config_db.
https://github.com/Azure/sonic-buildimage/blob/master/files/build_templates/init_cfg.json.j2

At the time of reboot process, the init_cfg.json file contents are written to config_db only when config_db.json file is present.
Please check here - https://github.com/Azure/sonic-buildimage/blob/master/files/build_templates/docker_image_ctl.j2#L122

So at time of onie-install, config_db.json file is not present and there by "FEATURE" table is not getting written to config_db.
At first boot-up process, the "config_db.json" file is generated at step - https://github.com/Azure/sonic-buildimage/blob/master/files/image_config/config-setup/config-setup#L240

And here https://github.com/Azure/sonic-buildimage/blob/master/files/image_config/config-setup/config-setup#L252, load_config() is not writing the init_cfg.json file contents to config_db.
so all the init_cfg.json file contents are missing in config_db after first boot-up (onie-install) is done.

Fix for this to replace the load_config() with reload_configdb(), where 'config reload' script takes care of writing init_cfg.json file contents to config_db.
Please check here - https://github.com/Azure/sonic-utilities/blob/master/config/main.py#L1095

@ben-gale
Copy link
Collaborator

ben-gale commented Jan 4, 2021

@abdosi - are you ready to approve pls?

Copy link
Contributor

@abdosi abdosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abdosi abdosi merged commit 62e7c45 into sonic-net:master Jan 5, 2021
/usr/local/bin/db_migrator.py -o migrate
fi

sonic-db-cli CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have a dependency on this CONFIG_DB_INITIALIZED elsewhere. Do we not need this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lguohan pushed a commit that referenced this pull request Jan 6, 2021
)

Fix the After first bootup(onie-install), the FEATURE table is not present in CONFIG_DB. 
Fix is done by calling config reload.
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.

6 participants