@@ -52,6 +52,24 @@ function wait_for_database_service()
52
52
done
53
53
}
54
54
55
+ function getBootType()
56
+ {
57
+ case " $( cat /proc/cmdline | grep -o ' SONIC_BOOT_TYPE=\S*' | cut -d' =' -f2) " in
58
+ warm* )
59
+ TYPE=' warm'
60
+ ;;
61
+ fastfast)
62
+ TYPE=' fastfast'
63
+ ;;
64
+ fast* )
65
+ TYPE=' fast'
66
+ ;;
67
+ * )
68
+ TYPE=' cold'
69
+ esac
70
+ echo " ${TYPE} "
71
+ }
72
+
55
73
start () {
56
74
debug " Starting ${SERVICE} service..."
57
75
@@ -74,17 +92,23 @@ start() {
74
92
/usr/bin/docker exec database redis-cli -n 1 FLUSHDB
75
93
76
94
# platform specific tasks
77
- if [ x$sonic_asic_platform == x' mellanox' ]; then
78
- export FAST_BOOT=1
79
- /usr/bin/mst start
80
- /usr/bin/mlnx-fw-upgrade.sh
81
- /etc/init.d/sxdkernel start
82
- /sbin/modprobe i2c-dev
83
- elif [ x$sonic_asic_platform == x' cavium' ]; then
95
+ if [ x$sonic_asic_platform == x' cavium' ]; then
84
96
/etc/init.d/xpnet.sh start
85
97
fi
86
98
fi
87
99
100
+ # platform specific tasks
101
+ if [ x" $sonic_asic_platform " == x" mellanox" ]; then
102
+ BOOT_TYPE=` getBootType`
103
+ if [[ x" $WARM_BOOT " == x" true" || x" $BOOT_TYPE " == x" fast" ]]; then
104
+ export FAST_BOOT=1
105
+ fi
106
+ /usr/bin/mst start
107
+ /usr/bin/mlnx-fw-upgrade.sh
108
+ /etc/init.d/sxdkernel start
109
+ /sbin/modprobe i2c-dev
110
+ fi
111
+
88
112
# start service docker
89
113
/usr/bin/${SERVICE} .sh start
90
114
debug " Started ${SERVICE} service..."
@@ -106,32 +130,37 @@ stop() {
106
130
TYPE=cold
107
131
fi
108
132
109
- debug " ${TYPE} shutdown syncd process ..."
110
- /usr/bin/docker exec -i syncd /usr/bin/syncd_request_shutdown --${TYPE}
133
+ if [[ x$sonic_asic_platform != x" mellanox" ]] || [[ x$TYPE != x" cold" ]]; then
134
+ debug " ${TYPE} shutdown syncd process ..."
135
+ /usr/bin/docker exec -i syncd /usr/bin/syncd_request_shutdown --${TYPE}
111
136
112
- # wait until syncd quits gracefully
113
- while docker top syncd | grep -q /usr/bin/syncd; do
114
- sleep 0.1
115
- done
137
+ # wait until syncd quits gracefully
138
+ while docker top syncd | grep -q /usr/bin/syncd; do
139
+ sleep 0.1
140
+ done
116
141
117
- /usr/bin/docker exec -i syncd /bin/sync
118
- debug " Finished ${TYPE} shutdown syncd process ..."
142
+ /usr/bin/docker exec -i syncd /bin/sync
143
+ debug " Finished ${TYPE} shutdown syncd process ..."
144
+ fi
119
145
120
146
/usr/bin/${SERVICE} .sh stop
121
147
debug " Stopped ${SERVICE} service..."
122
148
123
149
# if warm start enabled, don't stop peer service docker
124
150
if [[ x" $WARM_BOOT " != x" true" ]]; then
125
151
# platform specific tasks
126
- if [ x$sonic_asic_platform == x' mellanox' ]; then
127
- /etc/init.d/sxdkernel stop
128
- /usr/bin/mst stop
129
- elif [ x$sonic_asic_platform == x' cavium' ]; then
152
+ if [ x$sonic_asic_platform == x' cavium' ]; then
130
153
/etc/init.d/xpnet.sh stop
131
154
/etc/init.d/xpnet.sh start
132
155
fi
133
156
fi
134
157
158
+ # platform specific tasks
159
+ if [ x" $sonic_asic_platform " == x" mellanox" ]; then
160
+ /etc/init.d/sxdkernel stop
161
+ /usr/bin/mst stop
162
+ fi
163
+
135
164
unlock_service_state_change
136
165
}
137
166
0 commit comments