File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,21 @@ function reboot_dpu()
165165
166166 debug " User requested rebooting device ${DPU_NAME} ..."
167167
168+ # Check if the DPU operation status is online before rebooting
169+ local oper_status
170+ oper_status=$( show chassis modules status " ${DPU_NAME^^} " | sed -n ' /^ *DPU/ s/.*\s\+\(Online\|Offline\)\s\+.*/\1/p' )
171+ if [ $? -ne 0 ]; then
172+ log_message " ERROR: Failed to retrieve DPU status."
173+ return ${EXIT_ERROR}
174+ fi
175+
176+ log_message " INFO: DPU ${DPU_NAME} is in '$oper_status ' state before reboot."
177+ oper_status=$( echo " $oper_status " | tr ' [:upper:]' ' [:lower:]' )
178+ if [ " $oper_status " != " online" ]; then
179+ log_message " INFO: ${DPU_NAME} is not online. Current status: $oper_status "
180+ return ${EXIT_ERROR}
181+ fi
182+
168183 # Send reboot command to DPU
169184 gnmi_reboot_dpu " ${DPU_NAME} "
170185 if [ $? -ne 0 ]; then
You can’t perform that action at this time.
0 commit comments