From 532a3ff0535897a9991dc805bcc031eb29cb25e0 Mon Sep 17 00:00:00 2001 From: spenugondaa Date: Thu, 3 Jun 2021 02:22:27 +0000 Subject: [PATCH 1/2] Event and Alarm Framework : persist Event DB for cold boot Signed-off-by: spenugondaa --- scripts/reboot | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/reboot b/scripts/reboot index dfbd309ba8..e3f6d1a402 100755 --- a/scripts/reboot +++ b/scripts/reboot @@ -90,6 +90,21 @@ function clear_warm_boot() /sbin/kexec -u || /bin/true } +function backup_database() +{ + COLD_DIR=/host/coldboot + REDIS_FILE=dump.rdb + mkdir -p $COLD_DIR + + # Dump redis EventDB content to file in case 'dump.rdb' in case of coldreboot + sonic-db-cli EVENT_DB save + + docker cp database:/var/lib/redis4/$REDIS_FILE $COLD_DIR + + # Cleanup all dump.rdb files, if any + docker exec -i database find /var/lib/ | grep $REDIS_FILE | xargs docker exec -i database rm +} + SCRIPT=$0 function show_help_and_exit() @@ -173,6 +188,8 @@ stop_sonic_services clear_warm_boot +backup_database + # Update the reboot cause file to reflect that user issued 'reboot' command # Upon next boot, the contents of this file will be used to determine the # cause of the previous reboot From 205581836c34c8d34d90aaaeb11bee6a40729da6 Mon Sep 17 00:00:00 2001 From: spenugondaa Date: Mon, 14 Jun 2021 18:30:27 +0000 Subject: [PATCH 2/2] EventDB redis database to be presisted on coldboot. --- scripts/reboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/reboot b/scripts/reboot index e3f6d1a402..3daef25797 100755 --- a/scripts/reboot +++ b/scripts/reboot @@ -99,7 +99,7 @@ function backup_database() # Dump redis EventDB content to file in case 'dump.rdb' in case of coldreboot sonic-db-cli EVENT_DB save - docker cp database:/var/lib/redis4/$REDIS_FILE $COLD_DIR + docker cp database:/var/lib/redis1/$REDIS_FILE $COLD_DIR # Cleanup all dump.rdb files, if any docker exec -i database find /var/lib/ | grep $REDIS_FILE | xargs docker exec -i database rm