-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[E1031] add platform specific reboot command support #15889
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
CPLD_SETREG_PATH="/sys/bus/platform/devices/e1031.smc/setreg" | ||
|
||
# Board level power cycle | ||
echo "0x0113 0xAA" > ${CPLD_SETREG_PATH} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
REBOOT_USER=$(logname) | ||
REBOOT_TIME=$(date) | ||
REBOOT_CAUSE_FILE="/host/reboot-cause/reboot-cause.txt" | ||
|
||
echo "User issued 'reboot' with platform-specific command [User: ${REBOOT_USER}, Time: ${REBOOT_TIME}]" > ${REBOOT_CAUSE_FILE} | ||
sync | ||
/sbin/fstrim -av | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @qnos why do we need trim at this point? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Cold reboot is a kind of force power cycle, add fstrim to try reducing the disk segment before force reboot. Commonly in non-test environment, cold reboot wouldn't be called frequently, so it wouldn't do harm to SSD health and lifecycle. Even in test environment, hundreds of reboot test would introduce obvious effect to SSD. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @qnos reducing the disk segment means? how cold reboot affects SSD health/life? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
fstrim could be used for disk defragmentation, i meant using fstrim(called by cold reboot script) too frequently would affect SSD health. But in reboot case, that wouldn't be frequent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @qnos I think Prince's questions is on why we need do this fstrim here? Since we already have cronjob to do daily fstrim, it seems like unnecessary to do fstrim before power-cycle. Do you have any other concern to have this operation here? If not, I think we'd better remove it since it is not related to the power-cycle. |
||
sleep 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qnos is the filesystem unmounted at this stage? if not, it can cause FS corruption
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understand your concern, I will add fs umount logic before power cycle. Thanks.