From 6e39ce2603bde9f76259a71af3327311e7436e26 Mon Sep 17 00:00:00 2001 From: Shawn Li Date: Mon, 4 Feb 2019 11:18:27 -0800 Subject: [PATCH 01/10] Fix showing systemd shutdown sequence when verbose is set --- files/Aboot/boot0.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index f64a2286bc..a366748de8 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -313,7 +313,10 @@ run_kexec() { 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)}" - if ! $verbose; then + if $verbose; then + # show systemd showdown sequence when verbose is set + cmdline="$cmdline systemd.show_status=true" + else # Start showing systemd information from the first failing unit if any. # systemd.show_status=false or quiet can be used to silence systemd entierly cmdline="$cmdline systemd.show_status=auto" From 5e7ea23b0d3df314f3d445a2922982ede8aa1752 Mon Sep 17 00:00:00 2001 From: Yury Murashka Date: Sun, 10 Feb 2019 14:23:03 -0800 Subject: [PATCH 02/10] Fix creation of kernel-cmdline file Sometimes boot0 prints error "mv: can't preserve ownership of '/mnt/flash/image-arsonic.xxxx/kernel-cmdline': Operation not permitted" --- files/Aboot/boot0.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index a366748de8..562fa6ffc1 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -304,7 +304,7 @@ write_boot_configs() { fi fi - mv /tmp/append $cmdline_image + cat /tmp/append > $cmdline_image [ -e ${target_path}/machine.conf ] || write_machine_config } From c16e74f6fc449a01f5cffccefffe26765c87512b Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Thu, 22 Nov 2018 10:58:07 -0800 Subject: [PATCH 03/10] Improve flash space usage during installation Some older systems only have 2GB of flash available. Installing a second image on these can prove to be challenging. The new installation process moves the installer swi to memory in order to avoid free up space from the flash before uncompressing it there. It removes all the flash space usage spike and also improves the IO since the installation is no more reading and writting to the flash at the same time. --- files/Aboot/boot0.j2 | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 562fa6ffc1..fb8eeb0ce7 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -68,6 +68,8 @@ cmdline_base="$target_path/kernel-params-base" cmdline_image="$image_path/kernel-cmdline" boot_config="$target_path/boot-config" +swi_tmpfs="/tmp/tmp-swi" + bootconfigvars="KERNEL INITRD CONSOLESPEED PASSWORD NETDEV NETAUTO NETIP NETMASK NETGW NETDOMAIN NETDNS NETHW memtest" flash_re=" /mnt/flash| /host" @@ -126,9 +128,34 @@ update_next_boot() { fi } +move_swi_to_tmpfs() { + local oldswi="$1" + local newswi="$swi_tmpfs/$(basename $oldswi)" + + mkdir -p "$swi_tmpfs" + if ! $in_aboot && ! mount | grep -q ' /tmp type tmpfs'; then + # mount a real tmpfs on /tmp/tmp-swi if /tmp is not one already. + mount -t tmpfs tmp-swi "$swi_tmpfs" + fi + + mv "$oldswi" "$newswi" + echo "$newswi" +} + +cleanup_swi_tmpfs() { + rm -f "$swipath" + if mount | grep -q "$swi_tmpfs"; then + umount "$swi_tmpfs" || : + fi +} + extract_image() { mkdir -p "$image_path" + info "Moving swi to a tmpfs" + ## Avoid problematic flash usage spike on older systems, also improves I/O + swipath="$(move_swi_to_tmpfs $swipath)" + info "Extracting swi content" ## Unzip the image except boot0 and dockerfs archive unzip -oq "$swipath" -x boot0 "$dockerfs" -d "$image_path" @@ -146,7 +173,6 @@ extract_image() { fi ## extract docker archive - info "Unpacking $dockerfs" unzip -oqp "$swipath" "$dockerfs" | tar xzf - -C "$image_path/{{ DOCKERFS_DIR }}" $TAR_EXTRA_OPTION else ## save dockerfs archive in the image directory @@ -154,14 +180,15 @@ extract_image() { info "Unpacking $dockerfs delayed to initrd because $target_path is $rootfs_type" fi + ## remove installer since it's not needed anymore + info "Remove installer" + cleanup_swi_tmpfs + ## use new reduced-size boot swi local swi_boot_path="flash:$image_name/{{ ABOOT_BOOT_IMAGE }}" update_boot_config SWI "$swi_boot_path" update_boot_config SWI_DEFAULT "$swi_boot_path" - ## Remove installer swi as it has lots of redundunt contents - rm -f "$swipath" - ## sync disk operations sync } From 64ab5fc186b7f7870875444971c59df1d6dee0b5 Mon Sep 17 00:00:00 2001 From: Yury Murashka Date: Tue, 19 Mar 2019 11:03:59 -0800 Subject: [PATCH 04/10] Add support of 7060CX-32S-SSD --- files/Aboot/boot0.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index fb8eeb0ce7..bab1801dc9 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -232,7 +232,8 @@ platform_specific() { flash_size=3700 echo "modprobe.blacklist=radeon,sp5100_tco" >>/tmp/append fi - if [ "$sid" = "Upperlake" ] || [ "$sid" = "UpperlakeES" ]; then + if [ "$sid" = "Upperlake" ] || [ "$sid" = "UpperlakeES" ] || + [ "$sid" = "UpperlakeSsd" ]; then aboot_machine=arista_7060_cx32s flash_size=3700 echo "amd_iommu=off" >> /tmp/append From b8c9a54766e7acfb756122771729d68e4d28e505 Mon Sep 17 00:00:00 2001 From: Julien Gomes Date: Thu, 18 Apr 2019 15:29:54 -0700 Subject: [PATCH 05/10] platform: arista: add common platform_reboot Replace platform_reboot by a link to new common for devices already using a similar script. --- .../arista/x86_64-arista_7060px4_32/platform_reboot | 12 +----------- device/arista/x86_64-arista_7170_64c/platform_reboot | 12 +----------- device/arista/x86_64-arista_common/platform_reboot | 11 +++++++++++ 3 files changed, 13 insertions(+), 22 deletions(-) mode change 100755 => 120000 device/arista/x86_64-arista_7060px4_32/platform_reboot mode change 100755 => 120000 device/arista/x86_64-arista_7170_64c/platform_reboot create mode 100755 device/arista/x86_64-arista_common/platform_reboot diff --git a/device/arista/x86_64-arista_7060px4_32/platform_reboot b/device/arista/x86_64-arista_7060px4_32/platform_reboot deleted file mode 100755 index 9010dcb280..0000000000 --- a/device/arista/x86_64-arista_7060px4_32/platform_reboot +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python - -from arista import platforms -from arista.utils.sonic_reboot import reboot - -def main(): - # reboot the system - reboot() - -if __name__ == "__main__": - main() diff --git a/device/arista/x86_64-arista_7060px4_32/platform_reboot b/device/arista/x86_64-arista_7060px4_32/platform_reboot new file mode 120000 index 0000000000..7f94a49e38 --- /dev/null +++ b/device/arista/x86_64-arista_7060px4_32/platform_reboot @@ -0,0 +1 @@ +../x86_64-arista_common/platform_reboot \ No newline at end of file diff --git a/device/arista/x86_64-arista_7170_64c/platform_reboot b/device/arista/x86_64-arista_7170_64c/platform_reboot deleted file mode 100755 index b8b1a5d7bf..0000000000 --- a/device/arista/x86_64-arista_7170_64c/platform_reboot +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python - -import arista.platforms -from arista.utils.sonic_reboot import reboot - -def main(): - # reboot the system - reboot() - -if __name__ == "__main__": - main() diff --git a/device/arista/x86_64-arista_7170_64c/platform_reboot b/device/arista/x86_64-arista_7170_64c/platform_reboot new file mode 120000 index 0000000000..7f94a49e38 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/platform_reboot @@ -0,0 +1 @@ +../x86_64-arista_common/platform_reboot \ No newline at end of file diff --git a/device/arista/x86_64-arista_common/platform_reboot b/device/arista/x86_64-arista_common/platform_reboot new file mode 100755 index 0000000000..b8b1a5d7bf --- /dev/null +++ b/device/arista/x86_64-arista_common/platform_reboot @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +import arista.platforms +from arista.utils.sonic_reboot import reboot + +def main(): + # reboot the system + reboot() + +if __name__ == "__main__": + main() From 054a97770414af5e4784186832ba027a6c052b20 Mon Sep 17 00:00:00 2001 From: Julien Gomes Date: Wed, 17 Apr 2019 17:41:42 -0700 Subject: [PATCH 06/10] 7260CX3: use inventory powerCycle procedures --- .../x86_64-arista_7260cx3_64/platform_reboot | 88 +------------------ 1 file changed, 1 insertion(+), 87 deletions(-) mode change 100755 => 120000 device/arista/x86_64-arista_7260cx3_64/platform_reboot diff --git a/device/arista/x86_64-arista_7260cx3_64/platform_reboot b/device/arista/x86_64-arista_7260cx3_64/platform_reboot deleted file mode 100755 index 8a37224611..0000000000 --- a/device/arista/x86_64-arista_7260cx3_64/platform_reboot +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2018 Arista Networks, Inc. All rights reserved. -# Arista Networks, Inc. Confidential and Proprietary. - -# Reboot script for 7260CX3 - -from __future__ import print_function -import sys -import mmap, os -import subprocess -from struct import pack, unpack - -class MmapResource( object ): - """Resource implementation for a directly-mapped memory region.""" - - def __init__( self, path ): - try: - fd = os.open( path, os.O_RDWR ) - except EnvironmentError: - print( "FAIL can not open scd memory-map resource file" ) - print( "FAIL are you running on the proper platform?" ) - sys.exit( 1 ) - try: - size = os.fstat( fd ).st_size - except EnvironmentError: - print( "FAIL can not fstat scd memory-map resource file" ) - print( "FAIL are you running on the proper platform?" ) - sys.exit( 1 ) - try: - self.mmap_ = mmap.mmap( fd, size, mmap.MAP_SHARED, - mmap.PROT_READ | mmap.PROT_WRITE ) - except EnvironmentError: - print( "FAIL can not map scd memory-map file" ) - print( "FAIL are you running on the proper platform?" ) - sys.exit( 1 ) - finally: - try: - # Note that closing the file descriptor has no effect on the memory map - os.close( fd ) - except EnvironmentError: - print( "FAIL failed to close scd memory-map file" ) - sys.exit( 1 ) - - def read32( self, addr ): - return unpack( ' Date: Wed, 17 Apr 2019 17:45:26 -0700 Subject: [PATCH 07/10] 7050QX-32S: use inventory powerCycle procedures --- .../x86_64-arista_7050_qx32s/platform_reboot | 88 +------------------ 1 file changed, 1 insertion(+), 87 deletions(-) mode change 100755 => 120000 device/arista/x86_64-arista_7050_qx32s/platform_reboot diff --git a/device/arista/x86_64-arista_7050_qx32s/platform_reboot b/device/arista/x86_64-arista_7050_qx32s/platform_reboot deleted file mode 100755 index 6e9da63950..0000000000 --- a/device/arista/x86_64-arista_7050_qx32s/platform_reboot +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2018 Arista Networks, Inc. All rights reserved. -# Arista Networks, Inc. Confidential and Proprietary. - -# Reboot script for 7050QX-32S - -from __future__ import print_function -import sys -import mmap, os -import subprocess -from struct import pack, unpack - -class MmapResource( object ): - """Resource implementation for a directly-mapped memory region.""" - - def __init__( self, path ): - try: - fd = os.open( path, os.O_RDWR ) - except EnvironmentError: - print( "FAIL can not open scd memory-map resource file" ) - print( "FAIL are you running on the proper platform?" ) - sys.exit( 1 ) - try: - size = os.fstat( fd ).st_size - except EnvironmentError: - print( "FAIL can not fstat scd memory-map resource file" ) - print( "FAIL are you running on the proper platform?" ) - sys.exit( 1 ) - try: - self.mmap_ = mmap.mmap( fd, size, mmap.MAP_SHARED, - mmap.PROT_READ | mmap.PROT_WRITE ) - except EnvironmentError: - print( "FAIL can not map scd memory-map file" ) - print( "FAIL are you running on the proper platform?" ) - sys.exit( 1 ) - finally: - try: - # Note that closing the file descriptor has no effect on the memory map - os.close( fd ) - except EnvironmentError: - print( "FAIL failed to close scd memory-map file" ) - sys.exit( 1 ) - - def read32( self, addr ): - return unpack( ' Date: Wed, 17 Apr 2019 17:46:30 -0700 Subject: [PATCH 08/10] 7050QX-32: use inventory powerCycle procedures --- .../x86_64-arista_7050_qx32/platform_reboot | 88 +------------------ 1 file changed, 1 insertion(+), 87 deletions(-) mode change 100755 => 120000 device/arista/x86_64-arista_7050_qx32/platform_reboot diff --git a/device/arista/x86_64-arista_7050_qx32/platform_reboot b/device/arista/x86_64-arista_7050_qx32/platform_reboot deleted file mode 100755 index da438b8fe5..0000000000 --- a/device/arista/x86_64-arista_7050_qx32/platform_reboot +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2018 Arista Networks, Inc. All rights reserved. -# Arista Networks, Inc. Confidential and Proprietary. - -# Reboot script for 7050QX-32 - -from __future__ import print_function -import sys -import mmap, os -import subprocess -from struct import pack, unpack - -class MmapResource( object ): - """Resource implementation for a directly-mapped memory region.""" - - def __init__( self, path ): - try: - fd = os.open( path, os.O_RDWR ) - except EnvironmentError: - print( "FAIL can not open scd memory-map resource file" ) - print( "FAIL are you running on the proper platform?" ) - sys.exit( 1 ) - try: - size = os.fstat( fd ).st_size - except EnvironmentError: - print( "FAIL can not fstat scd memory-map resource file" ) - print( "FAIL are you running on the proper platform?" ) - sys.exit( 1 ) - try: - self.mmap_ = mmap.mmap( fd, size, mmap.MAP_SHARED, - mmap.PROT_READ | mmap.PROT_WRITE ) - except EnvironmentError: - print( "FAIL can not map scd memory-map file" ) - print( "FAIL are you running on the proper platform?" ) - sys.exit( 1 ) - finally: - try: - # Note that closing the file descriptor has no effect on the memory map - os.close( fd ) - except EnvironmentError: - print( "FAIL failed to close scd memory-map file" ) - sys.exit( 1 ) - - def read32( self, addr ): - return unpack( ' Date: Wed, 17 Apr 2019 17:47:40 -0700 Subject: [PATCH 09/10] 7060CX-32S: use inventory powerCycle procedures --- .../x86_64-arista_7060_cx32s/platform_reboot | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) mode change 100755 => 120000 device/arista/x86_64-arista_7060_cx32s/platform_reboot diff --git a/device/arista/x86_64-arista_7060_cx32s/platform_reboot b/device/arista/x86_64-arista_7060_cx32s/platform_reboot deleted file mode 100755 index 0e801683fa..0000000000 --- a/device/arista/x86_64-arista_7060_cx32s/platform_reboot +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2018 Arista Networks, Inc. All rights reserved. -# Arista Networks, Inc. Confidential and Proprietary. - -# Reboot script for 7060CX-32 - -from __future__ import print_function - -import smbus - -def main(): - print( "Rebooting" ) - bus = smbus.SMBus( 1 ) - bus.write_byte_data( 0x23, 0x04, 0xde ) - print( "REBOOTED" ) - -if __name__ == "__main__": - main() diff --git a/device/arista/x86_64-arista_7060_cx32s/platform_reboot b/device/arista/x86_64-arista_7060_cx32s/platform_reboot new file mode 120000 index 0000000000..7f94a49e38 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/platform_reboot @@ -0,0 +1 @@ +../x86_64-arista_common/platform_reboot \ No newline at end of file From 8a06c7b3598734513264aa47365f8ee52ec18d78 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 14 May 2019 10:36:57 -0700 Subject: [PATCH 10/10] Install python smbus in pmon Some platform plugin need the python smbus library to perform some actions. This installs the dependency. --- dockers/docker-platform-monitor/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index bc91e28f4a..829db1369a 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -7,7 +7,7 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s ENV DEBIAN_FRONTEND=noninteractive # Install required packages -RUN apt-get update && apt-get install -y python-pip libpython2.7 ipmitool librrd8 librrd-dev rrdtool +RUN apt-get update && apt-get install -y python-pip libpython2.7 ipmitool librrd8 librrd-dev rrdtool python-smbus {% if docker_platform_monitor_debs.strip() -%} # Copy locally-built Debian package dependencies