sonic-mgmt icon indicating copy to clipboard operation
sonic-mgmt copied to clipboard

Fix _backup_and_restore_config_db to properly restore config_db.json after upgrade

Open andywongarista opened this issue 1 year ago • 1 comments

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 avatar Mar 25 '24 19:03 andywongarista

@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.

vaibhavhd avatar Apr 12 '24 06:04 vaibhavhd

hi @andywongarista could you check the comments from Vaibhav?

StormLiangMS avatar Apr 21 '24 14:04 StormLiangMS

@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.

andywongarista avatar Apr 23 '24 21:04 andywongarista

hi @vaibhavhd let me know if you approve this?

StormLiangMS avatar Apr 26 '24 04:04 StormLiangMS

Cherry-pick PR to 202311: https://github.com/sonic-net/sonic-mgmt/pull/12774

mssonicbld avatar May 09 '24 04:05 mssonicbld