sonic-mgmt
sonic-mgmt copied to clipboard
Fix _backup_and_restore_config_db to properly restore config_db.json after upgrade
Description of PR
Summary: Fixes # (issue)
Type of change
- [x] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [ ] Test case(new/improvement)
Back port request
- [ ] 201911
- [ ] 202012
- [ ] 202205
- [x] 202305
- [x] 202311
Approach
What is the motivation for this PR?
test_warm_upgrade_sad_path fails in teardown because it is unable to restore config_db. This is because in the event of an upgrade, config_db backup is deleted if stored in /etc/sonic/.
How did you do it?
Instead of storing config_db backup in /etc/sonic/, store in /host instead.
How did you verify/test it?
Ran test_warm_upgrade_sad_path and verified it passes
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation
@andywongarista one possible downside of this change that I suggest you evaluate:
If in cross-branch upgrade test this restore is done then it may pick up the config from the old OS version (base OS) and apply this old config on new OS version (target OS).
This config reload of old-config on new OS version may not work, or fully be supported due to old config containing/missing some config entries needed by new OS.
Please assess this concern before merging. Otherwise, this LGTM.
hi @andywongarista could you check the comments from Vaibhav?
@vaibhavhd The logic to restore config_db was already part of the original SAD testcase that you authored, this review is just fixing that behaviour so that it happens as expected. From our testing of upgrades from 202012 to 202305, we did not run into any issues, but I don't have any data on which cross-branch upgrades are safe and which aren't. This seems like a broader issue that should be addressed in a future PR.
hi @vaibhavhd let me know if you approve this?
Cherry-pick PR to 202311: https://github.com/sonic-net/sonic-mgmt/pull/12774