forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sonic-package-manager] support warm/fast reboot for extension packag…
…es (sonic-net#1554) - What I did Implemented functionality for SONiC package manager allowing to support packages wich require special handling for fast and warm reboots. For more details refer to HLD - https://github.com/stepanblyschak/SONiC/blob/sonic-app-ext-3/doc/sonic-application-extention/sonic-application-extention-hld.md#warmboot-and-fastboot-design-impact. - How I did it I extended manifest with warm/fast shutdown fields and added a logic that will account special requirements on fast/warm reboot for a package. Fast/Warm reboot scripts are enhanced to read the ordered list of services from a file on filesystem instead of having the list of services hardcoded in the script. This file is regenerated when package is installed/uninstalled/upgraded and also this file will be generated once during build time. Similary, a warmboot-finalizer service is enhanced by making it read the file on filesystem with processes that perfrom reconciliation. - How to verify it There is an open example extension I pushed to Docker Hub stepanblischak/cpu-report:warm. It can be installed on the switch: admin@sonic:~$ sudo sonic-package-manager show package manifest --from-repository stepanblischak/cpu-report:warm | grep warm -A 6 "warm-shutdown": { "after": [ "swss" ], "before": [ "syncd" ] admin@sonic;~$ sudo sonic-package-manager install --from-repository stepanblischak/cpu-report:warm -y -v DEBUG Then perform warm-reboot and observe that cpu-report is stopped at the right place in shutdown sequence: admin@sonic:~$ sudo warm-reboot -v sudo warm-reboot -v Wed 31 Mar 2021 12:54:10 PM UTC Saving counters folder before warmboot... Wed 31 Mar 2021 12:54:13 PM UTC Prepare MLNX ASIC to fastfast-reboot: install new FW if required Wed 31 Mar 2021 12:54:15 PM UTC Pausing orchagent ... Wed 31 Mar 2021 12:54:15 PM UTC Collecting logs to check ssd health before fastfast-reboot... Wed 31 Mar 2021 12:54:15 PM UTC Stopping lldp ... Wed 31 Mar 2021 12:54:17 PM UTC Stopped lldp Wed 31 Mar 2021 12:54:17 PM UTC Stopping nat ... Dumping conntrack entries failed Wed 31 Mar 2021 12:54:18 PM UTC Stopped nat Wed 31 Mar 2021 12:54:18 PM UTC Stopping radv ... Wed 31 Mar 2021 12:54:18 PM UTC Stopped radv Wed 31 Mar 2021 12:54:18 PM UTC Stopping sflow ... Wed 31 Mar 2021 12:54:18 PM UTC Stopped sflow Wed 31 Mar 2021 12:54:18 PM UTC Stopping bgp ... Wed 31 Mar 2021 12:54:22 PM UTC Stopped bgp Wed 31 Mar 2021 12:54:22 PM UTC Stopping swss ... Wed 31 Mar 2021 12:54:31 PM UTC Stopped swss Wed 31 Mar 2021 12:54:31 PM UTC Initialize pre-shutdown ... Wed 31 Mar 2021 12:54:31 PM UTC Requesting pre-shutdown ... Wed 31 Mar 2021 12:54:32 PM UTC Waiting for pre-shutdown ... Wed 31 Mar 2021 12:54:41 PM UTC Pre-shutdown succeeded, state: pre-shutdown-succeeded ... Wed 31 Mar 2021 12:54:41 PM UTC Backing up database ... Wed 31 Mar 2021 12:54:41 PM UTC Stopping cpu-report... Wed 31 Mar 2021 12:54:41 PM UTC Stopped cpu-report Wed 31 Mar 2021 12:54:41 PM UTC Stopping teamd ... Wed 31 Mar 2021 12:54:48 PM UTC Stopped teamd Wed 31 Mar 2021 12:54:48 PM UTC Stopping syncd ... Wed 31 Mar 2021 12:54:51 PM UTC Stopped syncd Wed 31 Mar 2021 12:54:51 PM UTC Stopping all remaining containers ... Wed 31 Mar 2021 12:54:53 PM UTC Stopped all remaining containers ... Wed 31 Mar 2021 12:54:55 PM UTC Enabling Watchdog before fastfast-reboot Watchdog armed for 180 seconds Wed 31 Mar 2021 12:54:56 PM UTC Rebooting with /sbin/kexec -e to SONiC-OS-master.0-ae9ccf39 ...
- Loading branch information
1 parent
793b847
commit 4818360
Showing
11 changed files
with
465 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/python3 | ||
|
||
''' This script is used to generate initial warm/fast shutdown order file ''' | ||
|
||
from sonic_package_manager import PackageManager | ||
|
||
def main(): | ||
manager = PackageManager.get_manager() | ||
installed_packages = manager.get_installed_packages() | ||
print('installed packages {}'.format(installed_packages)) | ||
manager.service_creator.generate_shutdown_sequence_files(installed_packages) | ||
print('Done.') | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.