Skip to content

Commit dbe07a4

Browse files
Harish Venkatramanlguohan
Harish Venkatraman
authored andcommitted
[sonic-platform-modules-dell] Graceful platform reboot (#2912)
The following commit addresses the graceful unmounting of file system and graceful shutdown of dockers before calling a cold reboot which will cause a power cycle of SSD. This ensures orderly shutdown and no corruption of files systems because of the power cycle to SSD. This commit will use the existing systemd-reboot service scripts and override the configuration to do cold reboot for S6100 and Z9100. Unit tested the fix and graceful shutdown of file system and dockers are done with cold reboot. Signed-off-by: Harish Venkatraman <[email protected]>
1 parent e2c8993 commit dbe07a4

File tree

6 files changed

+60
-2
lines changed

6 files changed

+60
-2
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ s6100/scripts/iom_power_*.sh usr/local/bin
22
s6100/scripts/s6100_platform.sh usr/local/bin
33
common/dell_i2c_utils.sh usr/local/bin
44
common/io_rd_wr.py usr/local/bin
5+
s6100/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
6+
s6100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d
57
common/dell_lpc_mon.sh usr/local/bin
6-
common/platform_reboot usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
78
s6100/scripts/platform_sensors.py usr/local/bin
89
s6100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
910
s6100/scripts/platform_watchdog_enable.sh usr/local/bin

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ z9100/scripts/z9100_platform.sh usr/local/bin
33
common/dell_i2c_utils.sh usr/local/bin
44
common/dell_lpc_mon.sh usr/local/bin
55
common/io_rd_wr.py usr/local/bin
6-
common/platform_reboot usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
6+
z9100/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
7+
z9100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d
78
z9100/scripts/platform_sensors.py usr/local/bin
89
z9100/scripts/sensors usr/bin
910
z9100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Service]
2+
ExecStart=
3+
ExecStart=/usr/share/sonic/device/x86_64-dell_s6100_c2538-r0/platform_reboot_override
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/python
2+
import sys
3+
import os
4+
import struct
5+
6+
PORT_RES = '/dev/port'
7+
8+
9+
def portio_reg_write(resource, offset, val):
10+
fd = os.open(resource, os.O_RDWR)
11+
if(fd < 0):
12+
print 'file open failed %s" % resource'
13+
return
14+
if(os.lseek(fd, offset, os.SEEK_SET) != offset):
15+
print 'lseek failed on %s' % resource
16+
return
17+
ret = os.write(fd, struct.pack('B', val))
18+
if(ret != 1):
19+
print 'write failed %d' % ret
20+
return
21+
os.close(fd)
22+
23+
if __name__ == "__main__":
24+
portio_reg_write(PORT_RES, 0xcf9, 0xe)
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Service]
2+
ExecStart=
3+
ExecStart=/usr/share/sonic/device/x86_64-dell_z9100_c2538-r0/platform_reboot_override
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/python
2+
import sys
3+
import os
4+
import struct
5+
6+
PORT_RES = '/dev/port'
7+
8+
9+
def portio_reg_write(resource, offset, val):
10+
fd = os.open(resource, os.O_RDWR)
11+
if(fd < 0):
12+
print 'file open failed %s" % resource'
13+
return
14+
if(os.lseek(fd, offset, os.SEEK_SET) != offset):
15+
print 'lseek failed on %s' % resource
16+
return
17+
ret = os.write(fd, struct.pack('B', val))
18+
if(ret != 1):
19+
print 'write failed %d' % ret
20+
return
21+
os.close(fd)
22+
23+
if __name__ == "__main__":
24+
portio_reg_write(PORT_RES, 0xcf9, 0xe)
25+

0 commit comments

Comments
 (0)