diff --git a/.gitmodules b/.gitmodules index 7076a352e506..c214cefecb5b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -38,12 +38,14 @@ [submodule "src/sonic-utilities"] path = src/sonic-utilities url = https://github.com/Azure/sonic-utilities + branch = 201811 [submodule "platform/broadcom/sonic-platform-modules-arista"] path = platform/broadcom/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic [submodule "src/sonic-platform-common"] path = src/sonic-platform-common url = https://github.com/Azure/sonic-platform-common + branch = 201811 [submodule "src/sonic-platform-daemons"] path = src/sonic-platform-daemons url = https://github.com/Azure/sonic-platform-daemons diff --git a/Makefile.work b/Makefile.work index 6c4828134a8a..eb71a774cab2 100644 --- a/Makefile.work +++ b/Makefile.work @@ -27,6 +27,9 @@ # * make NOSTRETCH=1 KEEP_SLAVE_ON=yes # * SOURCE_FOLDER: host path to be mount as /var/$(USER)/src, only effective when KEEP_SLAVE_ON=yes # * SONIC_BUILD_JOBS: Specifying number of concurrent build job(s) to run +# * VS_PREPARE_MEM: Prepare memory in VS build (drop cache and compact). +# * Default: yes +# * Values: yes, no # * KERNEL_PROCURE_METHOD: Specifying method of obtaining kernel Debian package: download or build # ############################################################################### @@ -114,6 +117,7 @@ SONIC_BUILD_INSTRUCTION := make \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ + VS_PREPARE_MEM=$(VS_PREPARE_MEM) \ KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \ HTTP_PROXY=$(http_proxy) \ HTTPS_PROXY=$(https_proxy) \ diff --git a/build_debian.sh b/build_debian.sh index b8514e78d7a1..aa8c6b04eb70 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -29,7 +29,7 @@ set -x -e ## docker engine version (with platform) -DOCKER_VERSION=5:18.09.0~3-0~debian-stretch +DOCKER_VERSION=5:18.09.2~3-0~debian-stretch LINUX_KERNEL_VERSION=4.9.0-8 ## Working directory to prepare the file system @@ -150,8 +150,8 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/union-mou sudo cp files/initramfs-tools/varlog $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog # Management interface (eth0) dhcp can be optionally turned off (during a migration from another NOS to SONiC) -sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp -sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp +#sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp +#sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp sudo cp files/initramfs-tools/union-fsck $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck pushd $FILESYSTEM_ROOT/usr/share/initramfs-tools/scripts/init-bottom && sudo patch -p1 < $OLDPWD/files/initramfs-tools/udev.patch; popd @@ -263,6 +263,10 @@ sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64- ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec +## Modifty ntp default configuration: disable initial jump (add -x), and disable +## jump when time difference is greater than 1000 seconds (remove -g). +sudo sed -i "s/NTPD_OPTS='-g'/NTPD_OPTS='-x'/" $FILESYSTEM_ROOT/etc/default/ntp + ## Fix ping tools permission so non root user can directly use them ## Note: this is a workaround since aufs doesn't support extended attributes ## Ref: https://github.com/moby/moby/issues/5650#issuecomment-303499489 diff --git a/build_kvm_image.sh b/build_kvm_image.sh index b08db96f573c..bc0f54e12d5c 100755 --- a/build_kvm_image.sh +++ b/build_kvm_image.sh @@ -1,4 +1,4 @@ -#!/bin/sh -ex +#!/bin/bash -ex # Copyright (C) 2014 Curt Brune # @@ -47,6 +47,15 @@ prepare_installer_disk() create_disk prepare_installer_disk +echo "Prepare memory for KVM build: $vs_build_prepare_mem" +free -m +if [[ "$vs_build_prepare_mem" == "yes" ]]; then + # Force o.s. to drop cache and compact memory so that KVM can get 2G memory + sudo bash -c 'echo 1 > /proc/sys/vm/drop_caches' + sudo bash -c 'echo 1 > /proc/sys/vm/compact_memory' + free -m +fi + /usr/bin/kvm -m $MEM \ -name "onie" \ -boot "order=cd,once=d" -cdrom "$ONIE_RECOVERY_ISO" \ diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers.json.j2 new file mode 120000 index 000000000000..30c4e1d5bfdd --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers.json.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..a722094938f8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..b02d5e0194ac --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/pg_profile_lookup.ini new file mode 120000 index 000000000000..229a556f88a8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/pg_profile_lookup.ini @@ -0,0 +1 @@ +../ACS-MSN2700/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini new file mode 100644 index 000000000000..345e6a206731 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini @@ -0,0 +1,37 @@ +# name lanes speed alias index +Ethernet0 0,1,2,3 100000 etp1 1 +Ethernet4 4,5,6,7 100000 etp2 2 +Ethernet8 8,9,10,11 100000 etp3 3 +Ethernet12 12,13,14,15 100000 etp4 4 +Ethernet16 16,17,18,19 100000 etp5 5 +Ethernet20 20,21,22,23 100000 etp6 6 +Ethernet24 24,25,26,27 100000 etp7 7 +Ethernet28 28,29,30,31 100000 etp8 8 +Ethernet32 32,33,34,35 100000 etp9 9 +Ethernet36 36,37,38,39 100000 etp10 10 +Ethernet40 40,41,42,43 100000 etp11 11 +Ethernet44 44,45,46,47 100000 etp12 12 +Ethernet48 48,49,50,51 100000 etp13 13 +Ethernet52 52,53,54,55 100000 etp14 14 +Ethernet56 56,57,58,59 100000 etp15 15 +Ethernet60 60,61,62,63 100000 etp16 16 +Ethernet64 64,65,66,67 100000 etp17 17 +Ethernet68 68,69,70,71 100000 etp18 18 +Ethernet72 72,73,74,75 100000 etp19 19 +Ethernet76 76,77,78,79 100000 etp20 20 +Ethernet80 80,81,82,83 100000 etp21 21 +Ethernet84 84,85,86,87 100000 etp22 22 +Ethernet88 88,89,90,91 100000 etp23 23 +Ethernet92 92,93,94,95 100000 etp24 24 +Ethernet96 96,97,98,99 100000 etp25 25 +Ethernet100 100,101,102,103 100000 etp26 26 +Ethernet104 104,105,106,107 100000 etp27 27 +Ethernet108 108,109,110,111 100000 etp28 28 +Ethernet112 112,113 50000 etp29a 29 +Ethernet114 114,115 50000 etp29b 29 +Ethernet116 116,117 50000 etp30a 30 +Ethernet118 118,119 50000 etp30b 30 +Ethernet120 120,121 50000 etp31a 31 +Ethernet122 122,123 50000 etp31b 31 +Ethernet124 124,125 50000 etp32a 32 +Ethernet126 126,127 50000 etp32b 32 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/qos.json.j2 new file mode 120000 index 000000000000..8bd2d26567b8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/qos.json.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai.profile new file mode 100644 index 000000000000..cfeb4a5fa4ba --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700_8x50g_28x100g.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml new file mode 100644 index 000000000000..ee20db3e5dde --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml @@ -0,0 +1,250 @@ + + + + + + 00:02:03:04:05:00 + + + 1 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 11534336 + + + 3 + 4 + 17 + 1 + 11534336 + + + 5 + 4 + 18 + 3 + 11534336 + + + 7 + 4 + 19 + 1 + 11534336 + + + 9 + 4 + 20 + 3 + 11534336 + + + 11 + 4 + 21 + 1 + 11534336 + + + 13 + 4 + 22 + 3 + 11534336 + + + 15 + 4 + 23 + 1 + 11534336 + + + 17 + 4 + 24 + 3 + 11534336 + + + 19 + 4 + 25 + 1 + 11534336 + + + 21 + 4 + 26 + 3 + 11534336 + + + 23 + 4 + 27 + 1 + 11534336 + + + 25 + 4 + 28 + 3 + 3221225472 + 2 + + + 27 + 4 + 29 + 1 + 3221225472 + 2 + + + 29 + 4 + 30 + 3 + 3221225472 + 2 + + + 31 + 4 + 31 + 1 + 3221225472 + 2 + + + 33 + 4 + 14 + 3 + 11534336 + + + 35 + 4 + 15 + 1 + 11534336 + + + 37 + 4 + 12 + 3 + 11534336 + + + 39 + 4 + 13 + 1 + 11534336 + + + 41 + 4 + 10 + 3 + 11534336 + + + 43 + 4 + 11 + 1 + 11534336 + + + 45 + 4 + 8 + 3 + 11534336 + + + 47 + 4 + 9 + 1 + 11534336 + + + 49 + 4 + 6 + 3 + 11534336 + + + 51 + 4 + 7 + 1 + 11534336 + + + 53 + 4 + 4 + 3 + 11534336 + + + 55 + 4 + 5 + 1 + 11534336 + + + 57 + 4 + 2 + 3 + 11534336 + + + 59 + 4 + 3 + 1 + 11534336 + + + 61 + 4 + 0 + 3 + 11534336 + + + 63 + 4 + 1 + 1 + 11534336 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py index 9713873ed264..c11675766d3f 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py @@ -18,7 +18,15 @@ PMAOS_ENABLE = 1 PMAOS_DISABLE = 2 -def get_port_admin_status_by_log_port(log_port): +PORT_TYPE_NVE = 8 +PORT_TYPE_OFFSET = 28 +PORT_TYPE_MASK = 0xF0000000 +NVE_MASK = PORT_TYPE_MASK & (PORT_TYPE_NVE << PORT_TYPE_OFFSET) + +def is_nve(port): + return (port & NVE_MASK) != 0 + +def is_port_admin_status_up(log_port): oper_state_p = new_sx_port_oper_state_t_p() admin_state_p = new_sx_port_admin_state_t_p() module_state_p = new_sx_port_module_state_t_p() @@ -48,9 +56,10 @@ def get_log_ports(handle, sfp_module): log_port_list = [] for i in range(0, port_cnt): port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list, i) - if port_attributes.port_mapping.module_port == sfp_module: - if get_port_admin_status_by_log_port(port_attributes.log_port): - log_port_list.append(port_attributes.log_port) + if is_nve(int(port_attributes.log_port)) == False \ + and port_attributes.port_mapping.module_port == sfp_module \ + and is_port_admin_status_up(port_attributes.log_port): + log_port_list.append(port_attributes.log_port) return log_port_list diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index e4f9f05d41ff..531e06f13205 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -22,7 +22,7 @@ # magic code defnition for port number, qsfp port position of each hwsku # port_position_tuple = (PORT_START, QSFP_PORT_START, PORT_END, PORT_IN_BLOCK, EEPROM_OFFSET) -hwsku_dict = {'ACS-MSN2700': 0, "LS-SN2700":0, 'ACS-MSN2740': 0, 'ACS-MSN2100': 1, 'ACS-MSN2410': 2, 'ACS-MSN2010': 3, } +hwsku_dict = {'ACS-MSN2700': 0, "LS-SN2700":0, 'ACS-MSN2740': 0, 'ACS-MSN2100': 1, 'ACS-MSN2410': 2, 'ACS-MSN2010': 3, 'ACS-MSN3700': 0, 'ACS-MSN3700C': 0, 'Mellanox-SN2700': 0, 'Mellanox-SN2700-D48C8': 0} port_position_tuple_list = [(0, 0, 31, 32, 1), (0, 0, 15, 16, 1), (0, 48, 55, 56, 1),(0, 18, 21, 22, 1)] class SfpUtil(SfpUtilBase): diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index 2aef59241b13..c622e6a59843 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM debian:jessie +## Remove retired jessie-updates repo +RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list + # Clean documentation in FROM image RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true @@ -28,12 +31,9 @@ RUN apt-get -y install \ vim-tiny \ perl \ python \ + rsyslog \ less -# Install a newer version of rsyslog from jessie-backports in hopes of -# eliminating memory leaks -RUN apt-get -y -t jessie-backports install rsyslog - COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] COPY ["root/.vimrc", "/root/.vimrc"] diff --git a/dockers/docker-base/etc/rsyslog.conf b/dockers/docker-base/etc/rsyslog.conf index cf5509a3e8b3..1af66c6e61c0 100644 --- a/dockers/docker-base/etc/rsyslog.conf +++ b/dockers/docker-base/etc/rsyslog.conf @@ -14,6 +14,13 @@ ################# $ModLoad imuxsock # provides support for local system logging + +# +# Set a rate limit on messages from the container +# +$SystemLogRateLimitInterval 300 +$SystemLogRateLimitBurst 20000 + #$ModLoad imklog # provides kernel logging support #$ModLoad immark # provides --MARK-- message capability diff --git a/dockers/docker-base/sources.list b/dockers/docker-base/sources.list index 7121d6fd8c2d..2ed195cff416 100644 --- a/dockers/docker-base/sources.list +++ b/dockers/docker-base/sources.list @@ -5,4 +5,3 @@ deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-fre deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free -deb http://debian-archive.trafficmanager.net/debian/ jessie-backports main contrib non-free diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 2d9b1544d95a..7512627e9923 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -2,6 +2,9 @@ FROM debian:jessie MAINTAINER Pavel Shirshov +## Remove retired jessie-updates repo +RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list + ## Copy dependencies COPY \ {% for deb in docker_ptf_debs.split(' ') -%} diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 1385e1ebec63..9e56515fc1e6 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -30,6 +30,6 @@ RUN rm -rf /debs COPY ["start.sh", "/usr/bin/"] COPY ["docker-router-advertiser.supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["radvd.conf.j2", "/usr/share/sonic/templates/"] +COPY ["radvd.conf.j2", "wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-router-advertiser/start.sh b/dockers/docker-router-advertiser/start.sh index 159006a176bd..8d5f73a8bcb0 100755 --- a/dockers/docker-router-advertiser/start.sh +++ b/dockers/docker-router-advertiser/start.sh @@ -21,5 +21,12 @@ if [ $NUM_IFACES -eq 0 ]; then exit 0 fi +# Generate the script that waits for pertinent interfaces to come up and make it executable +sonic-cfggen -d -t /usr/share/sonic/templates/wait_for_intf.sh.j2 > /usr/bin/wait_for_intf.sh +chmod +x /usr/bin/wait_for_intf.sh + +# Wait for pertinent interfaces to come up +/usr/bin/wait_for_intf.sh + # Start the router advertiser supervisorctl start radvd diff --git a/dockers/docker-router-advertiser/wait_for_intf.sh.j2 b/dockers/docker-router-advertiser/wait_for_intf.sh.j2 new file mode 100644 index 000000000000..856c47678f23 --- /dev/null +++ b/dockers/docker-router-advertiser/wait_for_intf.sh.j2 @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +STATE_DB_IDX="6" + +VLAN_TABLE_PREFIX="VLAN_TABLE" + +function wait_until_iface_ready +{ + TABLE_PREFIX=$1 + IFACE=$2 + + echo "Waiting until interface $IFACE is ready..." + + # Wait for the interface to come up + # (i.e., interface is present in STATE_DB and state is "ok") + while true; do + RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null) + if [ x"$RESULT" == x"ok" ]; then + break + fi + + sleep 1 + done + + echo "Interface ${IFACE} is ready!" +} + + +# Wait for all interfaces to be up and ready +{% for (name, prefix) in VLAN_INTERFACE %} +wait_until_iface_ready ${VLAN_TABLE_PREFIX} {{ name }} +{% endfor %} diff --git a/files/build_templates/bgp.service.j2 b/files/build_templates/bgp.service.j2 index bc023b7d714d..7200a0e3ecf2 100644 --- a/files/build_templates/bgp.service.j2 +++ b/files/build_templates/bgp.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 9a26a8b1492c..2db9372340c4 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -29,18 +29,22 @@ def {# Port configuration to cable length look-up table #} {# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} {# Roles described in the minigraph #} -{%- set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } --%} +{%- if defs.ports2cable is defined %} + {%- set ports2cable = defs.ports2cable %} +{%- else %} + {%- set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } + -%} +{%- endif %} {%- macro cable_length(port_name) %} {%- set cable_len = [] %} {%- for local_port in DEVICE_NEIGHBOR %} {%- if local_port == port_name %} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} {%- set neighbor_role = neighbor.type %} {%- set roles1 = switch_role + '_' + neighbor_role %} @@ -127,10 +131,7 @@ def {{ defs.generate_pg_profils(port_names_active) }} {% else %} "BUFFER_PG": { - "{{ port_names_active }}|0-2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "{{ port_names_active }}|5-6": { + "{{ port_names_active }}|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } }, diff --git a/files/build_templates/database.service.j2 b/files/build_templates/database.service.j2 index b248dfc7fecd..efa98b168beb 100644 --- a/files/build_templates/database.service.j2 +++ b/files/build_templates/database.service.j2 @@ -6,7 +6,7 @@ After=docker.service [Service] User=root ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index b4d9ceb38f0c..5a462e53973d 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start -ExecStart=/usr/bin/{{ docker_container_name }}.sh attach +ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index a3cbf5adbae7..92c3f69c8a8d 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -103,9 +103,17 @@ start() { DOCKERCHECK=`docker inspect --type container {{docker_container_name}} 2>/dev/null` if [ "$?" -eq "0" ]; then + {%- if docker_container_name == "database" %} + DOCKERMOUNT="" + {%- else %} DOCKERMOUNT=`getMountPoint "$DOCKERCHECK"` - if [ "$DOCKERMOUNT" == "$HWSKU" ]; then + {%- endif %} + if [ x"$DOCKERMOUNT" == x"$HWSKU" ]; then + {%- if docker_container_name == "database" %} + echo "Starting existing {{docker_container_name}} container" + {%- else %} echo "Starting existing {{docker_container_name}} container with HWSKU $HWSKU" + {%- endif %} preStartAction docker start {{docker_container_name}} postStartAction @@ -150,8 +158,8 @@ start() { postStartAction } -attach() { - docker attach --no-stdin {{docker_container_name}} +wait() { + docker wait {{docker_container_name}} } stop() { @@ -159,11 +167,11 @@ stop() { } case "$1" in - start|stop|attach) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|stop|attach}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac diff --git a/files/build_templates/lldp.service.j2 b/files/build_templates/lldp.service.j2 index d294a08900f4..c317e18efc5c 100644 --- a/files/build_templates/lldp.service.j2 +++ b/files/build_templates/lldp.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/ntp-config.timer b/files/build_templates/ntp-config.timer deleted file mode 100644 index ab2d2e755ab2..000000000000 --- a/files/build_templates/ntp-config.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Delays NTP configuration service until SONiC has started - -[Timer] -OnBootSec=5min -Unit=ntp-config.service - -[Install] -WantedBy=timers.target diff --git a/files/build_templates/pmon.service.j2 b/files/build_templates/pmon.service.j2 index de4e62df5e10..33f3173b4887 100644 --- a/files/build_templates/pmon.service.j2 +++ b/files/build_templates/pmon.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 18d12d473941..a666367873bd 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -38,12 +38,12 @@ "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { "0": "0", - "1": "1", - "2": "2", + "1": "0", + "2": "0", "3": "3", "4": "4", - "5": "5", - "6": "6", + "5": "0", + "6": "0", "7": "7" } }, diff --git a/files/build_templates/radv.service.j2 b/files/build_templates/radv.service.j2 index 065f01906076..8cda2fdd0afb 100644 --- a/files/build_templates/radv.service.j2 +++ b/files/build_templates/radv.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start -ExecStart=/usr/bin/{{ docker_container_name }}.sh attach +ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index f344f2e805ea..b00c2107702c 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -6,5 +6,5 @@ Before=ntp-config.service [Service] ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 8064b2d71b04..0eeba7bad965 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -144,6 +144,11 @@ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.service sudo cp $IMAGE_CONFIGS/ntp/ntp-config.sh $FILESYSTEM_ROOT/usr/bin/ sudo cp $IMAGE_CONFIGS/ntp/ntp.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ +# Copy warmboot-finalizer files +sudo LANG=C cp $IMAGE_CONFIGS/warmboot-finalizer/finalize-warmboot.sh $FILESYSTEM_ROOT/usr/local/bin/finalize-warmboot.sh +sudo LANG=C cp $IMAGE_CONFIGS/warmboot-finalizer/warmboot-finalizer.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable warmboot-finalizer.service + # Copy rsyslog configuration files and templates sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable rsyslog-config.service @@ -302,9 +307,7 @@ sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh # Copy systemd timer configuration # It implements delayed start of services sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT/etc/systemd/system/ -sudo cp $BUILD_TEMPLATES/ntp-config.timer $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable snmp.timer -sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.timer sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get remove -y python-dev sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 906bae7c11c2..abf57b7bc89f 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -13,7 +13,8 @@ Before=ntp-config.service [Service] User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} -ExecStart=/usr/local/bin/swss.sh start +ExecStartPre=/usr/local/bin/swss.sh start +ExecStart=/usr/local/bin/swss.sh wait ExecStop=/usr/local/bin/swss.sh stop [Install] diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 index 70759f7c6b0d..0c61b3193877 100644 --- a/files/build_templates/syncd.service.j2 +++ b/files/build_templates/syncd.service.j2 @@ -13,12 +13,14 @@ After=opennsl-modules-4.9.0-8-amd64.service {% elif sonic_asic_platform == 'nephos' %} After=nps-modules-4.9.0-8-amd64.service {% endif %} +After=swss.service Before=ntp-config.service [Service] User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} -ExecStart=/usr/local/bin/syncd.sh start +ExecStartPre=/usr/local/bin/syncd.sh start +ExecStart=/usr/local/bin/syncd.sh wait ExecStop=/usr/local/bin/syncd.sh stop [Install] diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 5cd36c6748b9..792b8247119f 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/telemetry.service.j2 b/files/build_templates/telemetry.service.j2 index 132924b04193..d6f70a13206e 100644 --- a/files/build_templates/telemetry.service.j2 +++ b/files/build_templates/telemetry.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index f156f7e9402c..ae51af5cc8e4 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -44,8 +44,6 @@ class AaaCfg(object): def __init__(self): self.auth_default = { 'login': 'local', - 'failthrough': True, - 'fallback': True } self.tacplus_global_default = { 'auth_type': TACPLUS_SERVER_AUTH_TYPE_DEFAULT, @@ -159,14 +157,14 @@ class HostConfigDaemon: log_data = copy.deepcopy(data) if log_data.has_key('passkey'): log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data)) + syslog.syslog(syslog.LOG_INFO, 'value of {} changed to {}'.format(key, log_data)) def tacacs_global_handler(self, key, data): self.aaacfg.tacacs_global_update(key, data) log_data = copy.deepcopy(data) if log_data.has_key('passkey'): log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data)) + syslog.syslog(syslog.LOG_INFO, 'value of {} changed to {}'.format(key, log_data)) def start(self): self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data)) diff --git a/files/image_config/warmboot-finalizer/finalize-warmboot.sh b/files/image_config/warmboot-finalizer/finalize-warmboot.sh new file mode 100755 index 000000000000..653a00291f72 --- /dev/null +++ b/files/image_config/warmboot-finalizer/finalize-warmboot.sh @@ -0,0 +1,96 @@ +#! /bin/bash + +VERBOSE=no + +# Check components +COMP_LIST="orchagent neighsyncd bgp" +EXP_STATE="reconciled" + +ASSISTANT_SCRIPT="/usr/bin/neighbor_advertiser" + + +function debug() +{ + /usr/bin/logger "WARMBOOT_FINALIZER : $1" + if [[ x"${VERBOSE}" == x"yes" ]]; then + echo `date` "- $1" + fi +} + + +function check_warm_boot() +{ + WARM_BOOT=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|system" enable` +} + + +function wait_for_database_service() +{ + debug "Wait for database to become ready..." + + # Wait for redis server start before database clean + until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; + do sleep 1; + done + + # Wait for configDB initialization + until [[ $(/usr/bin/docker exec database redis-cli -n 4 GET "CONFIG_DB_INITIALIZED") ]]; + do sleep 1; + done + + debug "Database is ready..." +} + + +function get_component_state() +{ + /usr/bin/redis-cli -n 6 hget "WARM_RESTART_TABLE|$1" state +} + + +function check_list() +{ + RET_LIST='' + for comp in $@; do + state=`get_component_state ${comp}` + if [[ x"${state}" != x"${EXP_STATE}" ]]; then + RET_LIST="${RET_LIST} ${comp}" + fi + done + + echo ${RET_LIST} +} + + +function finalize_warm_boot() +{ + debug "Finalizing warmboot..." + sudo config warm_restart disable +} + + +wait_for_database_service + +check_warm_boot + +if [[ x"${WARM_BOOT}" != x"true" ]]; then + debug "warmboot is not enabled ..." + exit 0 +fi + +list=${COMP_LIST} + +# Wait up to 5 minutes +for i in `seq 60`; do + list=`check_list ${list}` + if [[ -z "${list}" ]]; then + break + fi + sleep 5 +done + +if [[ -n "${list}" ]]; then + debug "Some components didn't finish reconcile: ${list} ..." +fi + +finalize_warm_boot diff --git a/files/image_config/warmboot-finalizer/warmboot-finalizer.service b/files/image_config/warmboot-finalizer/warmboot-finalizer.service new file mode 100644 index 000000000000..72cc6e338982 --- /dev/null +++ b/files/image_config/warmboot-finalizer/warmboot-finalizer.service @@ -0,0 +1,11 @@ +[Unit] +Description=Monitor warm recovery and disable warmboot when done +Requires=database.service +After=database.service + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/finalize-warmboot.sh + +[Install] +WantedBy=multi-user.target diff --git a/files/initramfs-tools/mgmt-intf-dhcp b/files/initramfs-tools/mgmt-intf-dhcp deleted file mode 100644 index 52f7ff5f495c..000000000000 --- a/files/initramfs-tools/mgmt-intf-dhcp +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -PREREQS="union-mount" - -prereqs() { echo "$PREREQS"; } - -case $1 in - prereqs) - prereqs - exit 0 - ;; -esac - -# Extract kernel parameters -set -- $(cat /proc/cmdline) -for x in "$@"; do - case "$x" in - mgmt-intf-dhcp=*) - val="${x#mgmt-intf-dhcp=}" - - if [ -z "$val" ]; then - echo "ERROR: mgmt-intf-dhcp value (on/off) not specified !" - exit 0 - fi - - if [ -e "${rootmnt}/etc/network/interfaces" ]; then - if [ "$val" = "off" ]; then - sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' ${rootmnt}/etc/network/interfaces - elif [ "$val" = "on" ]; then - sed -i 's/iface eth0 inet static/iface eth0 inet dhcp/g' ${rootmnt}/etc/network/interfaces - fi - fi - - ;; - esac -done diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index d3e789d53afc..780051def9e6 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -78,6 +78,14 @@ function clean_up_tables() end" 0 } +startPeerService() { + check_warm_boot + + if [[ x"$WARM_BOOT" != x"true" ]]; then + /bin/systemctl start ${PEER} + fi +} + start() { debug "Starting ${SERVICE} service..." @@ -91,8 +99,9 @@ start() { # Don't flush DB during warm boot if [[ x"$WARM_BOOT" != x"true" ]]; then - debug "Flushing databases ..." + debug "Flushing APP, ASIC, COUNTER, CONFIG, and partial STATE databases ..." /usr/bin/docker exec database redis-cli -n 0 FLUSHDB + /usr/bin/docker exec database redis-cli -n 1 FLUSHDB /usr/bin/docker exec database redis-cli -n 2 FLUSHDB /usr/bin/docker exec database redis-cli -n 5 FLUSHDB clean_up_tables 6 "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*'" @@ -104,11 +113,11 @@ start() { # Unlock has to happen before reaching out to peer service unlock_service_state_change +} - if [[ x"$WARM_BOOT" != x"true" ]]; then - /bin/systemctl start ${PEER} - fi - /usr/bin/${SERVICE}.sh attach +wait() { + startPeerService + /usr/bin/${SERVICE}.sh wait } stop() { @@ -133,11 +142,11 @@ stop() { } case "$1" in - start|stop) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|stop}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 0247c7cd0583..0a2b9aefd0df 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -88,10 +88,6 @@ start() { touch /host/warmboot/warm-starting else rm -f /host/warmboot/warm-starting - - # Flush ASIC DB during non-warm start - debug "Flushing ASIC database ..." - /usr/bin/docker exec database redis-cli -n 1 FLUSHDB fi # platform specific tasks @@ -121,7 +117,10 @@ start() { debug "Started ${SERVICE} service..." unlock_service_state_change - /usr/bin/${SERVICE}.sh attach +} + +wait() { + /usr/bin/${SERVICE}.sh wait } stop() { @@ -155,16 +154,11 @@ stop() { # platform specific tasks - # stop mellanox driver regardless of - # shutdown type - if [ x$sonic_asic_platform == x'mellanox' ]; then - /etc/init.d/sxdkernel stop - /usr/bin/mst stop - fi - - if [[ x"$WARM_BOOT" != x"true" ]]; then - if [ x$sonic_asic_platform == x'cavium' ]; then + if [ x$sonic_asic_platform == x'mellanox' ]; then + /etc/init.d/sxdkernel stop + /usr/bin/mst stop + elif [ x$sonic_asic_platform == x'cavium' ]; then /etc/init.d/xpnet.sh stop /etc/init.d/xpnet.sh start fi @@ -174,11 +168,11 @@ stop() { } case "$1" in - start|stop) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|stop}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac diff --git a/files/sshd/host-ssh-keygen.sh b/files/sshd/host-ssh-keygen.sh index ade24e6383de..d4ea5bd431c1 100755 --- a/files/sshd/host-ssh-keygen.sh +++ b/files/sshd/host-ssh-keygen.sh @@ -1,10 +1,8 @@ #!/bin/bash +set -e + [ -r /etc/ssh/ssh_host_rsa_key ] || { rm -f /etc/ssh/ssh_host_*_key* /usr/bin/ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key - /usr/bin/ssh-keygen -t dsa -N '' -f /etc/ssh/ssh_host_dsa_key - /usr/bin/ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key - /usr/bin/ssh-keygen -t ecdsa -N '' -f /etc/ssh/ssh_host_ecdsa_key - /usr/bin/ssh-keygen -t ed25519 -N '' -f /etc/ssh/ssh_host_ed25519_key } diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 85eb0df51870..b8fb9ff4ac96 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -22,10 +22,10 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/docker-ptf-brcm.mk BCMCMD = bcmcmd -$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/bcmcmd?sv=2015-04-05&sr=b&sig=OCW4mfmbQ6D0BH8nllpAWrS8XL9uczrw32w3XgL4jws%3D&se=2030-03-31T23%3A06%3A15Z&sp=r" +$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/20190307/bcmcmd?sv=2015-04-05&sr=b&sig=sUdbU7oVbh5exbXXHVL5TDFBTWDDBASHeJ8Cp0B0TIc%3D&se=2038-05-06T22%3A34%3A19Z&sp=r" DSSERVE = dsserve -$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/dsserve?sv=2015-04-05&sr=b&sig=gyNbgSL%2FvpMXDdpboVkIJcTKMRdGgEaOR9OukHhEsu8%3D&se=2030-03-31T23%3A06%3A35Z&sp=r" +$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20190307/dsserve?sv=2015-04-05&sr=b&sig=lk7BH3DtW%2F5ehc0Rkqfga%2BUCABI0UzQmDamBsZH9K6w%3D&se=2038-05-06T22%3A34%3A45Z&sp=r" SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 99414ff9459a..48f86cc05e78 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1910.0906 +MLNX_FW_VERSION = 13.1910.0920 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/hw-management/hw-mgmt b/platform/mellanox/hw-management/hw-mgmt index 344e81942c02..498002ba528e 160000 --- a/platform/mellanox/hw-management/hw-mgmt +++ b/platform/mellanox/hw-management/hw-mgmt @@ -1 +1 @@ -Subproject commit 344e81942c02c279db03c3aba40db4142dc6817d +Subproject commit 498002ba528e5633bf1e9b8e488979ed731ca0f6 diff --git a/platform/mellanox/mlnx-ffb.sh b/platform/mellanox/mlnx-ffb.sh index 72187b94f858..1488bb2c6b97 100755 --- a/platform/mellanox/mlnx-ffb.sh +++ b/platform/mellanox/mlnx-ffb.sh @@ -42,11 +42,16 @@ check_sdk_upgrade() ISSU_VERSION_FILE_PATH="/etc/mlnx/issu-version" - [ -f "${SDK_VERSION_FILE_PATH}" ] || { + [ -f "${ISSU_VERSION_FILE_PATH}" ] || { >&2 echo "No ISSU version file found ${ISSU_VERSION_FILE_PATH}" break } + [ -f "${FS_MOUNTPOINT}/${ISSU_VERSION_FILE_PATH}" ] || { + >&2 echo "No ISSU version file found ${ISSU_VERSION_FILE_PATH} in ${NEXT_SONIC_IMAGE}" + break + } + CURRENT_ISSU_VERSION="$(cat ${ISSU_VERSION_FILE_PATH})" NEXT_ISSU_VERSION="$(cat ${FS_MOUNTPOINT}/${ISSU_VERSION_FILE_PATH})" diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index d5d3d53830a4..d5f242728d3b 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.13.3-master -MLNX_SAI_REVISION = 7cc737246fce514372cf8fd447360c5f11e7c8b9 +MLNX_SAI_VERSION = SAIRel1.13.4-master +MLNX_SAI_REVISION = 783d040465fb31771bcb9ec3d655d053e88b1bf0 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 3d5d949fa798..c9aed71fdc57 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,5 +1,5 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/9248a185b7da775b11daa5cb79ea22195c0b99f1/sdk -MLNX_SDK_VERSION = 4.3.0134 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/f3e389f1ba9535fdd6afb134897683b65d1ad4e7/sdk +MLNX_SDK_VERSION = 4.3.0136 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) diff --git a/platform/p4/docker-sonic-p4/rsyslog.conf b/platform/p4/docker-sonic-p4/rsyslog.conf index 79926a8b30c7..27e046257e18 100644 --- a/platform/p4/docker-sonic-p4/rsyslog.conf +++ b/platform/p4/docker-sonic-p4/rsyslog.conf @@ -14,6 +14,13 @@ ################# $ModLoad imuxsock # provides support for local system logging + +# +# Set a rate limit on messages from the container +# +$SystemLogRateLimitInterval 300 +$SystemLogRateLimitBurst 20000 + #$ModLoad imklog # provides kernel logging support #$ModLoad immark # provides --MARK-- message capability diff --git a/rules/config b/rules/config index 86139c71540f..674280a3ca2c 100644 --- a/rules/config +++ b/rules/config @@ -84,3 +84,6 @@ DEFAULT_KERNEL_PROCURE_METHOD = build # group during installation. FRR_USER_UID = 1000 FRR_USER_GID = 1000 + +# Default VS build memory preparation +DEFAULT_VS_PREPARE_MEM = yes diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index 129246d8fa2d..c77ce03d6520 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -2,6 +2,7 @@ DOCKER_ROUTER_ADVERTISER = docker-router-advertiser.gz $(DOCKER_ROUTER_ADVERTISER)_PATH = $(DOCKERS_PATH)/docker-router-advertiser +$(DOCKER_ROUTER_ADVERTISER)_DEPENDS += $(REDIS_TOOLS) $(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) diff --git a/rules/quagga.mk b/rules/quagga.mk index f4ba4f2d0be8..353cd5e3fac2 100644 --- a/rules/quagga.mk +++ b/rules/quagga.mk @@ -1,6 +1,11 @@ # quagga package -QUAGGA = quagga_0.99.24.1-2.1_amd64.deb +QUAGGA_VERSION_FULL = 0.99.24.1-2.1 + +QUAGGA = quagga_$(QUAGGA_VERSION_FULL)_amd64.deb $(QUAGGA)_DEPENDS += $(LIBSNMP_DEV) $(QUAGGA)_SRC_PATH = $(SRC_PATH)/sonic-quagga SONIC_DPKG_DEBS += $(QUAGGA) + +QUAGGA_DBG = quagga-dbg_$(QUAGGA_VERSION_FULL)_amd64.deb +$(eval $(call add_derived_package,$(QUAGGA),$(QUAGGA_DBG))) diff --git a/slave.mk b/slave.mk index 93811b43371c..b4b7f8de1f92 100644 --- a/slave.mk +++ b/slave.mk @@ -109,6 +109,10 @@ ifeq ($(SONIC_BUILD_JOBS),) override SONIC_BUILD_JOBS := $(SONIC_CONFIG_BUILD_JOBS) endif +ifeq ($(VS_PREPARE_MEM),) +override VS_PREPARE_MEM := $(DEFAULT_VS_PREPARE_MEM) +endif + ifeq ($(KERNEL_PROCURE_METHOD),) override KERNEL_PROCURE_METHOD := $(DEFAULT_KERNEL_PROCURE_METHOD) endif @@ -155,6 +159,7 @@ $(info "SONIC_DEBUGGING_ON" : "$(SONIC_DEBUGGING_ON)") $(info "SONIC_PROFILING_ON" : "$(SONIC_PROFILING_ON)") $(info "KERNEL_PROCURE_METHOD" : "$(KERNEL_PROCURE_METHOD)") $(info "BUILD_TIMESTAMP" : "$(BUILD_TIMESTAMP)") +$(info "VS_PREPARE_MEM" : "$(VS_PREPARE_MEM)") $(info ) ############################################################################### @@ -163,6 +168,7 @@ $(info ) ############################################################################### export kernel_procure_method=$(KERNEL_PROCURE_METHOD) +export vs_build_prepare_mem=$(VS_PREPARE_MEM) ############################################################################### ## Local targets diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index dc37d7947a1f..368f1bdfe3b1 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -2,11 +2,13 @@ FROM debian:jessie MAINTAINER johnar@microsoft.com +## Remove retired jessie-updates repo +RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list + RUN echo "deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \ echo "deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \ echo "deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb http://debian-archive.trafficmanager.net/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list + echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch b/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch new file mode 100644 index 000000000000..8a59756bb02b --- /dev/null +++ b/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch @@ -0,0 +1,36 @@ +From 43e512b114176feb1828ff0a75f0224f2b219a2d Mon Sep 17 00:00:00 2001 +From: Jipan Yang +Date: Sun, 24 Feb 2019 00:04:15 -0800 +Subject: [PATCH] Skip setting the same hwaddr to lag port to avoid disrupting + neighbor entries + +Signed-off-by: Jipan Yang +--- + teamd/teamd.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/teamd/teamd.c b/teamd/teamd.c +index 225b8c8..e28aa7d 100644 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -866,7 +866,16 @@ static int teamd_set_hwaddr(struct teamd_context *ctx) + err = -EINVAL; + goto free_hwaddr; + } +- err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); ++ ++ if(!memcmp(hwaddr, ctx->hwaddr, hwaddr_len)) ++ { ++ err = 0; ++ teamd_log_dbg("Skip setting same hwaddr string: \"%s\".", hwaddr_str); ++ } ++ else ++ { ++ err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); ++ } + if (!err) + ctx->hwaddr_explicit = true; + free_hwaddr: +-- +2.9.2 + diff --git a/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch b/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch new file mode 100644 index 000000000000..a603f91f62fe --- /dev/null +++ b/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch @@ -0,0 +1,34 @@ +From 7dff9798c2c92eb75b0120737efb81febcdb80c1 Mon Sep 17 00:00:00 2001 +From: Ying Xie +Date: Sun, 24 Mar 2019 21:49:59 +0000 +Subject: [PATCH] [teamd] register change handler for TEAM_IFINFO_CHANGE as + well + +There has been a race condition in the libnal/teamd interation, causing +TEAM_PORT_CHANGE to report a port with empty device name. Which then +causes the teamd unable to add the lag members into the lag. + +Registering to the TEAM_IFINFO_CHANGE would give teamd another chance to +add member again. + +Signed-off-by: Ying Xie +--- + teamd/teamd_per_port.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c +index 09d1dc7..137da57 100644 +--- a/teamd/teamd_per_port.c ++++ b/teamd/teamd_per_port.c +@@ -274,7 +274,7 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, + + static const struct team_change_handler port_priv_change_handler = { + .func = port_priv_change_handler_func, +- .type_mask = TEAM_PORT_CHANGE, ++ .type_mask = TEAM_PORT_CHANGE | TEAM_IFINFO_CHANGE, + }; + + int teamd_per_port_init(struct teamd_context *ctx) +-- +2.7.4 + diff --git a/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch b/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch new file mode 100644 index 000000000000..dad10a4c1ae9 --- /dev/null +++ b/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch @@ -0,0 +1,90 @@ +From fb00b070482dc587eec7b4e34acec094be1af00d Mon Sep 17 00:00:00 2001 +From: Ying Xie +Date: Fri, 29 Mar 2019 20:54:49 +0000 +Subject: [PATCH 10/11] [teamd] prevent private change handler reentrance + +While handling PORT_CHANGE, teamd could casue an INTERFACE_CHANGE in the +same context. Which will interfere with the PORT_CHANGE handling and +causing it to fail. + +Lock is not needed because the re-entrance happened in the same thread +context. + +This issue was noticed while dynamically adding a port into a lag. + +Signed-off-by: Ying Xie +--- + teamd/teamd.c | 2 ++ + teamd/teamd.h | 2 ++ + teamd/teamd_per_port.c | 13 +++++++++++-- + 3 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/teamd/teamd.c b/teamd/teamd.c +index e28aa7d..140b98b 100644 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -1255,6 +1255,8 @@ static int teamd_init(struct teamd_context *ctx) + { + int err; + ++ ctx->reentrant = false; ++ + ctx->th = team_alloc(); + if (!ctx->th) { + teamd_log_err("Team alloc failed."); +diff --git a/teamd/teamd.h b/teamd/teamd.h +index 622c365..7cd3266 100644 +--- a/teamd/teamd.h ++++ b/teamd/teamd.h +@@ -160,6 +160,8 @@ struct teamd_context { + int pipe_r; + int pipe_w; + } workq; ++ ++ bool reentrant; + }; + + struct teamd_port { +diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c +index 137da57..8b4a457 100644 +--- a/teamd/teamd_per_port.c ++++ b/teamd/teamd_per_port.c +@@ -250,6 +250,10 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, + struct port_obj *port_obj; + int err; + ++ if (ctx->reentrant) { ++ return 0; ++ } ++ ctx->reentrant = true; + team_for_each_port(port, th) { + uint32_t ifindex = team_get_port_ifindex(port); + +@@ -258,17 +262,22 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, + if (team_is_port_removed(port)) + continue; + err = port_obj_create(ctx, &port_obj, ifindex, port); +- if (err) ++ if (err) { ++ ctx->reentrant = false; + return err; ++ } + } + if (team_is_port_changed(port)) { + err = teamd_event_port_changed(ctx, _port(port_obj)); +- if (err) ++ if (err) { ++ ctx->reentrant = false; + return err; ++ } + } + if (team_is_port_removed(port)) + port_obj_remove(ctx, port_obj); + } ++ ctx->reentrant = false; + return 0; + } + +-- +2.7.4 + diff --git a/src/libteam/Makefile b/src/libteam/Makefile index 5dfa757f094d..256680d34943 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -12,15 +12,11 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./libteam git clone https://github.com/jpirko/libteam.git pushd ./libteam - git checkout -f v1.26 + git checkout -b teamd -f v1.26 - # Apply patch - git apply ../0001-libteam-Add-team_get_port_enabled-function.patch - git apply ../0002-libteam-Temporarily-remove-redundant-debug-mes.patch - git apply ../0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch - git apply ../0004-libteam-Add-lacp-fallback-support-for-single-member-.patch - git apply ../0005-libteam-Add-warm_reboot-mode.patch - git apply ../0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch + # Apply patch series + stg init + stg import -s ../series popd # Obtain debian packaging diff --git a/src/libteam/series b/src/libteam/series new file mode 100644 index 000000000000..a6c4893d021a --- /dev/null +++ b/src/libteam/series @@ -0,0 +1,9 @@ +0001-libteam-Add-team_get_port_enabled-function.patch +0002-libteam-Temporarily-remove-redundant-debug-mes.patch +0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch +0004-libteam-Add-lacp-fallback-support-for-single-member-.patch +0005-libteam-Add-warm_reboot-mode.patch +0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch +0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch +0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch +0009-teamd-prevent-private-change-handler-reentrance.patch diff --git a/src/sonic-config-engine/config_samples.py b/src/sonic-config-engine/config_samples.py index 6cb417b9a50b..adaea0c4532c 100644 --- a/src/sonic-config-engine/config_samples.py +++ b/src/sonic-config-engine/config_samples.py @@ -47,6 +47,8 @@ def generate_l2_config(data): if not data['DEVICE_METADATA']['localhost'].has_key('type'): data['DEVICE_METADATA']['localhost']['type'] = 'ToRRouter' data['VLAN'] = {'Vlan1000': {'vlanid': '1000'}} + vp = natsorted(data['PORT'].keys()) + data['VLAN']['Vlan1000'].setdefault('members', vp) data['VLAN_MEMBER'] = {} for port in natsorted(data['PORT'].keys()): data['VLAN_MEMBER']['Vlan1000|{}'.format(port)] = {'tagging_mode': 'untagged'} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 461b76acac03..9ab3d0f02be5 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -551,6 +551,10 @@ def parse_xml(filename, platform=None, port_config_file=None): for port in ports.itervalues(): port['mtu'] = '9100' + # asymmetric PFC is disabled by default + for port in ports.itervalues(): + port['pfc_asym'] = 'off' + # set physical port default admin status up for port in phyport_intfs: if port[0] in ports: diff --git a/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json index 269c155d68f3..0b6c8cbe19a3 100644 --- a/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json @@ -105,10 +105,7 @@ } }, "BUFFER_PG": { - "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0-2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|5-6": { + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } }, diff --git a/src/sonic-config-engine/tests/sample_output/qos-dell6100.json b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json index d1eced032f0d..0387e10dc2f2 100644 --- a/src/sonic-config-engine/tests/sample_output/qos-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json @@ -2,12 +2,12 @@ "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { "0": "0", - "1": "1", - "2": "2", + "1": "0", + "2": "0", "3": "3", "4": "4", - "5": "5", - "6": "6", + "5": "0", + "6": "0", "7": "7" } }, diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 1141419392c1..efaf686253f5 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -154,7 +154,7 @@ def test_minigraph_extra_neighbors(self): def test_minigraph_port_description(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet124\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/124', 'admin_status': 'up', 'lanes': '101,102,103,104', 'description': 'ARISTA04T1:Ethernet1/1', 'mtu': '9100'}") + self.assertEqual(output.strip(), "{'lanes': '101,102,103,104', 'description': 'ARISTA04T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/124', 'admin_status': 'up'}") def test_minigraph_bgp(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "BGP_NEIGHBOR[\'10.0.0.59\']"' @@ -174,48 +174,48 @@ def test_minigraph_deployment_id(self): def test_minigraph_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet8\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'lanes': '37,38,39,40', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}") + self.assertEqual(output.strip(), "{'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}") argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet12\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'lanes': '33,34,35,36', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'speed': '100000', 'fec': 'rs'}") + self.assertEqual(output.strip(), "{'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}") def test_minigraph_extra_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT"' output = self.run_script(argument) self.assertEqual(output.strip(), \ - "{'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}, " - "'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'alias': 'fortyGigE0/0', 'admin_status': 'up', 'speed': '10000'}, " - "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'fortyGigE0/4', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100'}, " - "'Ethernet100': {'alias': 'fortyGigE0/100', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100'}, " - "'Ethernet16': {'alias': 'fortyGigE0/16', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100'}, " - "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'speed': '100000', 'fec': 'rs'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100'}}") + "{'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}, " + "'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/0', 'admin_status': 'up', 'speed': '10000'}, " + "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'fortyGigE0/4', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100'}, " + "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100'}, " + "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100'}, " + "'Ethernet12': {'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100'}, " + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100'}}") def test_metadata_everflow(self): argument = '-m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '" -v "MIRROR_SESSION"' diff --git a/src/sonic-platform-common b/src/sonic-platform-common index d4bf78c9db4d..42119e19030e 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit d4bf78c9db4daf21497274a778748da4d8301866 +Subproject commit 42119e19030e33e8857f31f7a88d079fbe8edea9 diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index cb4fec9d078f..4cee38534919 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit cb4fec9d078f72ca378ecba5e6a112e3028c2221 +Subproject commit 4cee38534919e34f407363ac3ab5f31b4d09be6d diff --git a/src/sonic-sairedis b/src/sonic-sairedis index d57222a9879b..74f0f44bd790 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit d57222a9879b9ee28738d05b769b7e0ca5d50cd1 +Subproject commit 74f0f44bd7906b27d6e080614784919079afb66b diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 0f2bbd772704..26f04959a205 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 0f2bbd77270404e829815f95bf20b7d29af67930 +Subproject commit 26f04959a205d6493da8e3f989ae3803338aa2d7 diff --git a/src/sonic-swss b/src/sonic-swss index 584490c319be..ae74a27df766 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 584490c319be8e74444504538156e30ffadb8c4d +Subproject commit ae74a27df766321e0802f8bb38e9fa41dadffd88 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 286ef34f18ed..24c0ff7215e0 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 286ef34f18ed105532c6b5e0d5fcbc7e1bbd9073 +Subproject commit 24c0ff7215e0fd13e9247bda6a4f92862b8519da diff --git a/src/sonic-utilities b/src/sonic-utilities index b44b462a14b9..6aee909259e4 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit b44b462a14b9a4b7c2d6091b5355c046acd9dac8 +Subproject commit 6aee909259e4539c9d0a811fce8533a867f45090 diff --git a/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch b/src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch similarity index 54% rename from src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch rename to src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch index cb01665ba80b..6c4a6b7c2a4c 100644 --- a/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch +++ b/src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch @@ -1,15 +1,91 @@ -From 43b6f3ee93593f666af2c6a7af897bf3b5ee762d Mon Sep 17 00:00:00 2001 +From 5b56519e68e866662d9fd9a6681b6b47d6b5fcdb Mon Sep 17 00:00:00 2001 From: Joe LeVeque -Date: Wed, 17 Jan 2018 22:27:56 +0000 -Subject: [PATCH 2/2] Add unit test cases to ensure state transitions work if - system time has rolled backward +Date: Thu, 28 Feb 2019 01:43:54 +0000 +Subject: [PATCH] Prevent excessive hanging and crashes if system clock rolls + backward --- - supervisor/tests/test_process.py | 146 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 146 insertions(+) + supervisor/process.py | 36 ++++++ + supervisor/tests/test_process.py | 183 +++++++++++++++++++++++++++++++ + 2 files changed, 219 insertions(+) +diff --git a/supervisor/process.py b/supervisor/process.py +index f9ddcd9..5f73e6b 100644 +--- a/supervisor/process.py ++++ b/supervisor/process.py +@@ -347,6 +347,28 @@ class Subprocess: + options.write(2, "supervisor: child process was not spawned\n") + options._exit(127) # exit process with code for spawn failure + ++ def _check_and_adjust_for_system_clock_rollback(self, test_time): ++ """ ++ Check if system clock has rolled backward beyond test_time. If so, set ++ affected timestamps to test_time. ++ """ ++ if self.state == ProcessStates.STARTING: ++ if test_time < self.laststart: ++ self.laststart = test_time; ++ if self.delay > 0 and test_time < (self.delay - self.config.startsecs): ++ self.delay = test_time + self.config.startsecs ++ elif self.state == ProcessStates.RUNNING: ++ if test_time > self.laststart and test_time < (self.laststart + self.config.startsecs): ++ self.laststart = test_time - self.config.startsecs ++ elif self.state == ProcessStates.STOPPING: ++ if test_time < self.laststopreport: ++ self.laststopreport = test_time; ++ if self.delay > 0 and test_time < (self.delay - self.config.stopwaitsecs): ++ self.delay = test_time + self.config.stopwaitsecs ++ elif self.state == ProcessStates.BACKOFF: ++ if self.delay > 0 and test_time < (self.delay - self.backoff): ++ self.delay = test_time + self.backoff ++ + def stop(self): + """ Administrative stop """ + self.administrative_stop = True +@@ -357,6 +379,9 @@ class Subprocess: + """ Log a 'waiting for x to stop' message with throttling. """ + if self.state == ProcessStates.STOPPING: + now = time.time() ++ ++ self._check_and_adjust_for_system_clock_rollback(now) ++ + if now > (self.laststopreport + 2): # every 2 seconds + self.config.options.logger.info( + 'waiting for %s to stop' % self.config.name) +@@ -487,6 +512,9 @@ class Subprocess: + es, msg = decode_wait_status(sts) + + now = time.time() ++ ++ self._check_and_adjust_for_system_clock_rollback(now) ++ + self.laststop = now + processname = self.config.name + +@@ -586,6 +614,8 @@ class Subprocess: + now = time.time() + state = self.state + ++ self._check_and_adjust_for_system_clock_rollback(now) ++ + logger = self.config.options.logger + + if self.config.options.mood > SupervisorStates.RESTARTING: +@@ -805,6 +835,12 @@ class EventListenerPool(ProcessGroupBase): + if dispatch_capable: + if self.dispatch_throttle: + now = time.time() ++ ++ if now < self.last_dispatch: ++ # The system clock appears to have moved backward ++ # Reset self.last_dispatch accordingly ++ self.last_dispatch = now; ++ + if now - self.last_dispatch < self.dispatch_throttle: + return + self.dispatch() diff --git a/supervisor/tests/test_process.py b/supervisor/tests/test_process.py -index 7f9bab2..ea16315 100644 +index 7f9bab2..6808f60 100644 --- a/supervisor/tests/test_process.py +++ b/supervisor/tests/test_process.py @@ -736,6 +736,40 @@ class SubprocessTests(unittest.TestCase): @@ -53,7 +129,51 @@ index 7f9bab2..ea16315 100644 def test_give_up(self): options = DummyOptions() config = DummyPConfig(options, 'test', '/test') -@@ -1402,6 +1436,92 @@ class SubprocessTests(unittest.TestCase): +@@ -1105,6 +1139,43 @@ class SubprocessTests(unittest.TestCase): + self.assertEqual(event.__class__, events.ProcessStateBackoffEvent) + self.assertEqual(event.from_state, ProcessStates.STARTING) + ++ # This tests the case where the process has stayed alive longer than ++ # startsecs (i.e., long enough to enter the RUNNING state), however the ++ # system clock has since rolled backward such that the current time is ++ # greater than laststart but less than startsecs. ++ def test_finish_running_state_exited_too_quickly_due_to_clock_rollback(self): ++ options = DummyOptions() ++ config = DummyPConfig(options, 'notthere', '/notthere', ++ stdout_logfile='/tmp/foo', startsecs=10) ++ instance = self._makeOne(config) ++ instance.config.options.pidhistory[123] = instance ++ pipes = {'stdout':'','stderr':''} ++ instance.pipes = pipes ++ instance.config.exitcodes =[-1] ++ instance.laststart = time.time() ++ from supervisor.states import ProcessStates ++ from supervisor import events ++ instance.state = ProcessStates.RUNNING ++ L = [] ++ events.subscribe(events.ProcessStateEvent, lambda x: L.append(x)) ++ instance.pid = 123 ++ instance.finish(123, 1) ++ self.assertFalse(instance.killing) ++ self.assertEqual(instance.pid, 0) ++ self.assertEqual(options.parent_pipes_closed, pipes) ++ self.assertEqual(instance.pipes, {}) ++ self.assertEqual(instance.dispatchers, {}) ++ self.assertEqual(options.logger.data[0], ++ 'exited: notthere (terminated by SIGHUP; expected)') ++ self.assertEqual(instance.exitstatus, -1) ++ self.assertEqual(len(L), 1) ++ event = L[0] ++ self.assertEqual(event.__class__, ++ events.ProcessStateExitedEvent) ++ self.assertEqual(event.expected, True) ++ self.assertEqual(event.extra_values, [('expected', True), ('pid', 123)]) ++ self.assertEqual(event.from_state, ProcessStates.RUNNING) ++ + def test_finish_running_state_laststart_in_future(self): + options = DummyOptions() + config = DummyPConfig(options, 'notthere', '/notthere', +@@ -1402,6 +1473,92 @@ class SubprocessTests(unittest.TestCase): event = L[0] self.assertEqual(event.__class__, events.ProcessStateRunningEvent) @@ -146,7 +266,7 @@ index 7f9bab2..ea16315 100644 def test_transition_backoff_to_fatal(self): from supervisor import events L = [] -@@ -2033,6 +2153,32 @@ class EventListenerPoolTests(ProcessGroupBaseTests): +@@ -2033,6 +2190,32 @@ class EventListenerPoolTests(ProcessGroupBaseTests): self.assertEqual(process1.listener_state, EventListenerStates.BUSY) self.assertEqual(process1.event, event) @@ -180,5 +300,5 @@ index 7f9bab2..ea16315 100644 options = DummyOptions() from supervisor.states import ProcessStates -- -2.1.4 +2.17.1 diff --git a/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch b/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch deleted file mode 100644 index c0263e9baf10..000000000000 --- a/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch +++ /dev/null @@ -1,83 +0,0 @@ -From bac496af4c2051b3c15038e06533f9094b1c3604 Mon Sep 17 00:00:00 2001 -From: Joe LeVeque -Date: Tue, 16 Jan 2018 20:42:13 +0000 -Subject: [PATCH 1/2] Prevent excessive hanging/delays in process state - transitions if the system time rolls backward - ---- - supervisor/process.py | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - -diff --git a/supervisor/process.py b/supervisor/process.py -index f9ddcd9..216372f 100644 ---- a/supervisor/process.py -+++ b/supervisor/process.py -@@ -357,6 +357,12 @@ class Subprocess: - """ Log a 'waiting for x to stop' message with throttling. """ - if self.state == ProcessStates.STOPPING: - now = time.time() -+ -+ # If the system clock has moved backward, reset -+ # self.laststopreport to current system time -+ if now < self.laststopreport: -+ self.laststopreport = now; -+ - if now > (self.laststopreport + 2): # every 2 seconds - self.config.options.logger.info( - 'waiting for %s to stop' % self.config.name) -@@ -604,12 +610,27 @@ class Subprocess: - # STOPPED -> STARTING - self.spawn() - elif state == ProcessStates.BACKOFF: -+ if self.delay > 0 and now < self.delay - self.backoff: -+ # The system clock appears to have moved backward -+ # Reset self.delay accordingly -+ self.delay = now + self.backoff -+ - if self.backoff <= self.config.startretries: - if now > self.delay: - # BACKOFF -> STARTING - self.spawn() - - if state == ProcessStates.STARTING: -+ if now < self.laststart: -+ # The system clock appears to have moved backward -+ # Reset self.laststart to current system time -+ self.laststart = now; -+ -+ if self.delay > 0 and now < self.delay - self.config.startsecs: -+ # The system clock appears to have moved backward -+ # Reset self.delay accordingly -+ self.delay = now + self.config.startsecs -+ - if now - self.laststart > self.config.startsecs: - # STARTING -> RUNNING if the proc has started - # successfully and it has stayed up for at least -@@ -633,6 +654,11 @@ class Subprocess: - logger.info('gave up: %s %s' % (self.config.name, msg)) - - elif state == ProcessStates.STOPPING: -+ if self.delay > 0 and now < self.delay - self.config.stopwaitsecs: -+ # The system clock appears to have moved backward -+ # Reset self.delay accordingly -+ self.delay = now + self.config.stopwaitsecs -+ - time_left = self.delay - now - if time_left <= 0: - # kill processes which are taking too long to stop with a final -@@ -805,6 +831,12 @@ class EventListenerPool(ProcessGroupBase): - if dispatch_capable: - if self.dispatch_throttle: - now = time.time() -+ -+ # If the system clock has moved backward, reset -+ # self.last_dispatch to current system time -+ if now < self.last_dispatch: -+ self.last_dispatch = now; -+ - if now - self.last_dispatch < self.dispatch_throttle: - return - self.dispatch() --- -2.1.4 - diff --git a/src/supervisor/patch/series b/src/supervisor/patch/series index d141fddf3301..9d87dccfa780 100644 --- a/src/supervisor/patch/series +++ b/src/supervisor/patch/series @@ -1,2 +1,2 @@ -0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch -0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch +# This series applies on GIT commit 34b690aea8cf7572d73765c95c54a83261d69aad +0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch