[arista]: Fix convertfs condition for booting from EOS (#4139)

Fix the issue of incorrectly skipping the convertfs hook when fast-reboot from EOS, by adding an extra kernel cmdline param "prev_os" to differentiate fast-reboot from EOS and from SONiC.

This is because we still do disk conversion for fast reboot from eos to sonic, like format the disk.
This commit is contained in:
byu343 2020-02-11 18:44:25 -08:00 committed by GitHub
parent 169cfe79bf
commit fb3253329e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -383,7 +383,7 @@ write_boot_configs() {
} }
run_kexec() { run_kexec() {
local cmdline="$(cat $cmdline_image | tr '\n' ' ')" local cmdline="$(cat $cmdline_image | tr '\n' ' ') $ENV_EXTRA_CMDLINE"
local kernel="${KERNEL:-$(find $image_path/boot -name 'vmlinuz-*' -type f | head -n 1)}" local kernel="${KERNEL:-$(find $image_path/boot -name 'vmlinuz-*' -type f | head -n 1)}"
local initrd="${INITRD:-$(find $image_path/boot -name 'initrd.img-*' -type f | head -n 1)}" local initrd="${INITRD:-$(find $image_path/boot -name 'initrd.img-*' -type f | head -n 1)}"

View File

@ -18,6 +18,8 @@ flash_dev=''
block_flash='' block_flash=''
aboot_flag='' aboot_flag=''
backup_file='' backup_file=''
prev_os=''
sonic_fast_reboot=''
# Wait until get the fullpath of flash device, e.g., /dev/sda # Wait until get the fullpath of flash device, e.g., /dev/sda
wait_get_flash_dev() { wait_get_flash_dev() {
@ -133,9 +135,11 @@ for x in "$@"; do
docker_inram=*) docker_inram=*)
docker_inram="${x#docker_inram=}" docker_inram="${x#docker_inram=}"
;; ;;
prev_os=*)
prev_os="${x#prev_os=}"
;;
SONIC_BOOT_TYPE=warm*|SONIC_BOOT_TYPE=fast*) SONIC_BOOT_TYPE=warm*|SONIC_BOOT_TYPE=fast*)
# Skip this script for warm-reboot and fast-reboot sonic_fast_reboot=true
exit 0
;; ;;
esac esac
done done
@ -143,6 +147,9 @@ done
# Check aboot # Check aboot
[ -z "$aboot_flag" ] && exit 0 [ -z "$aboot_flag" ] && exit 0
# Skip this script for warm-reboot/fast-reboot from sonic
[ "$sonic_fast_reboot" == true ] && [ "$prev_os" != eos ] && exit 0
# Get flash dev name # Get flash dev name
if [ -z "$block_flash" ]; then if [ -z "$block_flash" ]; then
echo "Error: flash device info is not provided" echo "Error: flash device info is not provided"