Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ssd mitigation changes #4214

Merged
merged 4 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion files/image_config/fstrim/fstrim.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Description=Discard unused blocks

[Service]
Type=oneshot
ExecStart=/sbin/fstrim -av
ExecStart=/usr/bin/sonic-fstrim
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we run sonic-fstrim when it's available?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can. I have changed the permissions in the code base itself and built the image and tested it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rkdevi27 can we make platform_log_ssd_health more generically and run it from fstrim.service? And then we don't need sonic-fstrim any more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sujin,
As suggested, I have changed log_ssd_health as generic.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ s6100/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_s6100_
s6100/scripts/fast-reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/track_reboot_reason.sh usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/warm-reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/platform_log_ssd_health usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/platform_allow_fast_reboot usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/platform_post_sonic_install usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/platform_fstrim_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d
common/dell_lpc_mon.sh usr/local/bin
s6100/scripts/platform_sensors.py usr/local/bin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#! /bin/bash
SONIC_INSTALL_TIME_CHECK_SUCCESS=0
SONIC_INSTALL_TIME_CHECK_FAILED=1

ssd_type=$(show platform ssdhealth | grep "3IE3" | wc -l)
if [ $ssd_type -ne 0 ];then
if [ -f /tmp/install_timestamp ];then
secs1=`cat /tmp/install_timestamp`
secs2=`date +%s`
secs=$(( secs2 - secs1 ))
rem_secs=$(( 120 - secs ))
if [ $secs -lt 120 ];then
echo "Fast-reboot disallowed within 2 minutes after sonic install. Please try after $rem_secs seconds"
exit "${SONIC_INSTALL_TIME_CHECK_FAILED}"
else
exit "${SONIC_INSTALL_TIME_CHECK_SUCCESS}"
fi
else
exit "${SONIC_INSTALL_TIME_CHECK_SUCCESS}"
fi
fi

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/bash

ssd_type=$(show platform ssdhealth | grep "3IE3" | wc -l)
if [ $ssd_type -ne 0 ];then
logger "$(/sbin/fstrim -av)"
fi

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/bash

ssd_type=$(show platform ssdhealth | grep "3IE3" | wc -l)
if [ $ssd_type -ne 0 ];then
smartctl -a /dev/sda > /tmp/smartctl
if [ -f /tmp/smartctl ];then
logger -f /tmp/smartctl
fi
fi

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/bash

ssd_type=$(show platform ssdhealth | grep "3IE3" | wc -l)
if [ $ssd_type -ne 0 ];then
date +%s > /tmp/install_timestamp
fi