Skip to content

Commit 140576d

Browse files
authored
[201911] DellEMC S6100 SSD Monitor (#6934)
Why I did it To monitor the SSD health condition in DellEMC S6100 platform post upgrade. A daemon is introduced to monitor the SSD every one hour. To check for SSD status at boot time and at the time of cold-reboot. All these changes are supported only for newer SSD firmware. Added a platform_reboot_pre_check script to prevent cold-reboot based on SSD status. Depends on sonic-net/sonic-utilities#1472 DO NOT MERGE UNTIL ABOVE PR IS MERGED
1 parent 9b553d9 commit 140576d

9 files changed

+208
-0
lines changed

platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install

+7
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,20 @@ s6100/scripts/track_reboot_reason.sh usr/share/sonic/device/x86_64-dell_s6100_c2
1212
s6100/scripts/warm-reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
1313
s6100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d
1414
common/dell_lpc_mon.sh usr/local/bin
15+
s6100/scripts/s6100_ssd_mon.sh usr/local/bin
16+
s6100/scripts/s6100_ssd_upgrade_status.sh usr/local/bin
1517
s6100/scripts/platform_sensors.py usr/local/bin
18+
s6100/scripts/platform_reboot_pre_check usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
1619
s6100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
1720
s6100/scripts/platform_watchdog_enable.sh usr/local/bin
1821
s6100/scripts/platform_watchdog_disable.sh usr/local/bin
1922
s6100/scripts/sensors usr/bin
23+
s6100/scripts/iSMART_64 usr/local/bin
2024
s6100/systemd/platform-modules-s6100.service etc/systemd/system
2125
s6100/systemd/s6100-lpc-monitor.service etc/systemd/system
26+
s6100/systemd/s6100-ssd-monitor.service etc/systemd/system
27+
s6100/systemd/s6100-ssd-monitor.timer etc/systemd/system
28+
s6100/systemd/s6100-ssd-upgrade-status.service etc/systemd/system
2229
s6100/systemd/s6100-reboot-cause.service etc/systemd/system
2330
s6100/systemd/s6100-i2c-enumerate.service etc/systemd/system
2431
tools/flashrom/flashrom usr/local/bin/
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
SSD_FW_UPGRADE="/host/ssd_fw_upgrade"
3+
4+
# Check SSD Status
5+
if [ -e $SSD_FW_UPGRADE/GPIO7_low ] || [ -e $SSD_FW_UPGRADE/GPIO7_error ] || [ -e $SSD_FW_UPGRADE/GPIO_pending_upgrade ]; then
6+
logger -p user.crit -t DELL_S6100_SSD_MON "The SSD on this unit is faulty and does not support cold reboot."
7+
logger -p user.crit -t DELL_S6100_SSD_MON "Please perform a soft-/fast-/warm-reboot instead"
8+
exit 1
9+
fi
10+
11+
if [ -e $SSD_FW_UPGRADE/GPIO7_high ]; then
12+
iSMART="/usr/local/bin/iSMART_64"
13+
iSMART_OPTIONS="-d /dev/sda"
14+
15+
iSMART_CMD=`$iSMART $iSMART_OPTIONS`
16+
17+
GPIO_STATUS=$(echo "$iSMART_CMD" | grep GPIO | awk '{print $NF}')
18+
19+
if [ $GPIO_STATUS == "0x01" ];then
20+
exit 0
21+
else
22+
logger -p user.crit -t DELL_S6100_SSD_MON "The SSD on this unit is faulty and does not support cold reboot."
23+
logger -p user.crit -t DELL_S6100_SSD_MON "Please perform a soft-/fast-/warm-reboot instead"
24+
exit 1
25+
fi
26+
fi
27+
28+
exit 1

platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ if [[ "$1" == "init" ]]; then
3737
/usr/local/bin/platform_watchdog_disable.sh
3838
fi
3939

40+
systemctl start --no-block s6100-ssd-upgrade-status.service
41+
4042
is_fast_warm=$(cat /proc/cmdline | grep SONIC_BOOT_TYPE | wc -l)
4143

4244
if [[ "$is_fast_warm" == "1" ]]; then
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
SSD_FW_UPGRADE="/host/ssd_fw_upgrade"
4+
5+
if [ -e $SSD_FW_UPGRADE/GPIO7_high ]; then
6+
iSMART="/usr/local/bin/iSMART_64"
7+
iSMART_OPTIONS="-d /dev/sda"
8+
9+
iSMART_CMD=`$iSMART $iSMART_OPTIONS`
10+
GPIO_STATUS=$(echo "$iSMART_CMD" | grep GPIO | awk '{print $NF}')
11+
12+
if [ $GPIO_STATUS != "0x01" ];then
13+
logger -p user.crit -t DELL_S6100_SSD_MON "The SSD on this unit is faulty and does not support cold reboot."
14+
logger -p user.crit -t DELL_S6100_SSD_MON "If a reboot is required, please perform a soft-/fast-/warm-reboot."
15+
rm -rf $SSD_FW_UPGRADE/GPIO7_*
16+
touch $SSD_FW_UPGRADE/GPIO7_low
17+
systemctl stop s6100-ssd-monitor.timer
18+
fi
19+
else
20+
systemctl stop s6100-ssd-monitor.timer
21+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#!/bin/bash
2+
3+
SSD_FW_UPGRADE="/host/ssd_fw_upgrade"
4+
5+
if [ -e $SSD_FW_UPGRADE/GPIO7_high ]; then
6+
systemctl start --no-block s6100-ssd-monitor.timer
7+
exit 0
8+
fi
9+
10+
if [ -e $SSD_FW_UPGRADE/GPIO7_low ] || [ -e $SSD_FW_UPGRADE/GPIO7_error ]; then
11+
exit 0
12+
fi
13+
14+
[ ! -d $SSD_FW_UPGRADE ] && mkdir $SSD_FW_UPGRADE
15+
16+
SSD_UPGRADE_LOG="$SSD_FW_UPGRADE/upgrade.log"
17+
18+
SMART_CMD=`smartctl -a /dev/sda`
19+
20+
SSD_FW_VERSION=$(echo "$SMART_CMD" | grep "Firmware Version" | awk '{print $NF}')
21+
SSD_MODEL=$(echo "$SMART_CMD" | grep "Device Model" | awk '{print $NF}')
22+
23+
if [ -e $SSD_FW_UPGRADE/GPIO7_pending_upgrade ]; then
24+
if [ $SSD_FW_VERSION == "S141002C" ] || [ $SSD_FW_VERSION == "S16425c1" ]; then
25+
# If SSD Firmware is not upgraded
26+
exit 0
27+
fi
28+
fi
29+
30+
echo "$0 `date` SSD FW upgrade logs post reboot." >> $SSD_UPGRADE_LOG
31+
32+
iSMART="/usr/local/bin/iSMART_64"
33+
iSMART_OPTIONS="-d /dev/sda"
34+
iSMART_CMD=`$iSMART $iSMART_OPTIONS`
35+
36+
SSD_UPGRADE_STATUS1=`io_rd_wr.py --set --val 06 --offset 210; io_rd_wr.py --set --val 09 --offset 211; io_rd_wr.py --get --offset 212`
37+
SSD_UPGRADE_STATUS1=$(echo "$SSD_UPGRADE_STATUS1" | awk '{print $NF}')
38+
39+
SSD_UPGRADE_STATUS2=`io_rd_wr.py --set --val 06 --offset 210; io_rd_wr.py --set --val 0A --offset 211; io_rd_wr.py --get --offset 212`
40+
SSD_UPGRADE_STATUS2=$(echo "$SSD_UPGRADE_STATUS2" | awk '{print $NF}')
41+
42+
if [ $SSD_UPGRADE_STATUS1 == "2" ]; then
43+
rm -rf $SSD_FW_UPGRADE/GPIO7_*
44+
touch $SSD_FW_UPGRADE/GPIO7_error
45+
46+
echo "$0 `date` Upgraded to unknown version after first mp_64 upgrade." >> $SSD_UPGRADE_LOG
47+
48+
elif [ $SSD_UPGRADE_STATUS2 == "2" ];then
49+
rm -rf $SSD_FW_UPGRADE/GPIO7_*
50+
touch $SSD_FW_UPGRADE/GPIO7_error
51+
52+
echo "$0 `date` Upgraded to unknown version after second mp_64 upgrade." >> $SSD_UPGRADE_LOG
53+
54+
elif [ $SSD_FW_VERSION == "S141002G" ] || [ $SSD_FW_VERSION == "S16425cG" ]; then
55+
# If SSD Firmware is upgraded
56+
GPIO_STATUS=$(echo "$iSMART_CMD" | grep GPIO | awk '{print $NF}')
57+
58+
if [ $GPIO_STATUS != "0x01" ];then
59+
logger -p user.crit -t DELL_S6100_SSD_MON "The SSD on this unit is faulty and does not support reboot."
60+
logger -p user.crit -t DELL_S6100_SSD_MON "If a reboot is required, please perform a soft-/fast-/warm-reboot."
61+
rm -rf $SSD_FW_UPGRADE/GPIO7_*
62+
touch $SSD_FW_UPGRADE/GPIO7_low
63+
echo "$0 `date` The SSD on this unit is faulty and does not support cold reboot." >> $SSD_UPGRADE_LOG
64+
echo "$0 `date` If a reboot is required, please perform a soft-/fast-/warm-reboot." >> $SSD_UPGRADE_LOG
65+
66+
else
67+
rm -rf $SSD_FW_UPGRADE/GPIO7_*
68+
touch $SSD_FW_UPGRADE/GPIO7_high
69+
fi
70+
71+
systemctl start --no-block s6100-ssd-monitor.timer
72+
73+
if [ $SSD_UPGRADE_STATUS1 == "0" ]; then
74+
if [ $SSD_MODEL == "3IE" ];then
75+
echo "$0 `date` SSD FW upgraded from S141002C to S141002G in first mp_64." >> $SSD_UPGRADE_LOG
76+
else
77+
echo "$0 `date` SSD FW upgraded from S16425c1 to S16425cG in first mp_64." >> $SSD_UPGRADE_LOG
78+
fi
79+
elif [ $SSD_UPGRADE_STATUS2 == "1" ]; then
80+
echo "$0 `date` SSD entered loader mode in first mp_64 and upgraded to latest version after second mp_64." >> $SSD_UPGRADE_LOG
81+
fi
82+
83+
else
84+
if [ $SSD_UPGRADE_STATUS1 == "ff" ] && [ $SSD_UPGRADE_STATUS2 == "ff" ]; then
85+
rm -rf $SSD_FW_UPGRADE/GPIO7_*
86+
touch $SSD_FW_UPGRADE/GPIO7_pending_upgrade
87+
88+
echo "$0 `date` SSD upgrade didn’t happened." >> $SSD_UPGRADE_LOG
89+
90+
elif [ $SSD_UPGRADE_STATUS1 == "1" ]; then
91+
rm -rf $SSD_FW_UPGRADE/GPIO7_*
92+
touch $SSD_FW_UPGRADE/GPIO7_low
93+
logger -p user.crit -t DELL_S6100_SSD_MON "The SSD on this unit is faulty and does not support reboot."
94+
logger -p user.crit -t DELL_S6100_SSD_MON "If a reboot is required, please perform a soft-/fast-/warm-reboot."
95+
96+
echo "$0 `date` SSD entered loader mode in first mp_64 upgrade." >> $SSD_UPGRADE_LOG
97+
98+
if [ $SSD_UPGRADE_STATUS2 == "0" ]; then
99+
echo "$0 `date` SSD entered loader mode in first mp_64 and recovered back to older version in second mp_64." >> $SSD_UPGRADE_LOG
100+
fi
101+
fi
102+
103+
fi
104+
105+
echo "$0 `date` SMF Register 1 = $SSD_UPGRADE_STATUS1" >> $SSD_UPGRADE_LOG
106+
echo "$0 `date` SMF Register 2 = $SSD_UPGRADE_STATUS2" >> $SSD_UPGRADE_LOG
107+
echo "$SMART_CMD" >> $SSD_UPGRADE_LOG
108+
echo "$iSMART_CMD" >> $SSD_UPGRADE_LOG
109+
sync
110+
# Clearing the upgrade status
111+
io_rd_wr.py --set --val 06 --offset 210; io_rd_wr.py --set --val 09 --offset 211; io_rd_wr.py --set --val ff --offset 213
112+
io_rd_wr.py --set --val 06 --offset 210; io_rd_wr.py --set --val 0A --offset 211; io_rd_wr.py --set --val ff --offset 213
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Dell S6100 SSD monitoring poller
3+
DefaultDependencies=no
4+
5+
[Service]
6+
User=root
7+
ExecStart=/usr/local/bin/s6100_ssd_mon.sh
8+
RemainAfterExit=no
9+
10+
[Install]
11+
WantedBy=multi-user.target
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Dell S6100 SSD monitoring poller timer
3+
DefaultDependencies=no
4+
After=pmon.service
5+
6+
[Timer]
7+
OnBootSec=5min
8+
OnUnitActiveSec=60min
9+
10+
[Install]
11+
WantedBy=timers.target
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Unit]
2+
Description= Checking Dell S6100 SSD upgrade status
3+
After=pmon.service
4+
DefaultDependencies=no
5+
6+
[Service]
7+
User=root
8+
Type=oneshot
9+
ExecStart=/usr/local/bin/s6100_ssd_upgrade_status.sh
10+
RemainAfterExit=no
11+
12+
[Install]
13+
WantedBy=multi-user.target
14+

0 commit comments

Comments
 (0)