From 2c637f246e9e5c018774a3ad4c184d67f8ace9d4 Mon Sep 17 00:00:00 2001 From: Vasant Hegde Date: Tue, 1 Sep 2015 15:36:31 +0530 Subject: [PATCH] update_flash: Stop kexec service before starting firmware update on PowerVM LPAR We run 'reboot' call before initiating firmware update. If kexec service is enabled, then we endup booting into new kernel instead of starting firmware update. Commit 62dc6d38 fix this issue on PowerNV platform.. but missed to fix PowerVM LPAR. This patch fixes above described issue on PowerVM LPAR. Signed-off-by: Vasant Hegde --- Nathan, I've tested and this works fine on PowerVM Linux LPAR. -Vasant scripts/update_flash | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/scripts/update_flash b/scripts/update_flash index 00db874..aaaed1e 100755 --- a/scripts/update_flash +++ b/scripts/update_flash @@ -30,6 +30,7 @@ E_RTAS=8 # RTAS call failed E_USER=9 # User aborted operation E_OVERWRITE=10 # Auto overwrite permanent side image E_WRNTY=15 # Update Access Key Expired +E_KEXEC=16 # Kexec service stop error # Script Constants PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH @@ -108,6 +109,35 @@ usage() { exit $exit_code } +# Check kexec service status +check_kexec_service() { + # check systemctl command + which systemctl >/dev/null 2>&1 + if [ $? -ne 0 ]; then + return 1 + fi + + # kexec service is running + systemctl status kexec.service | grep -w "active" >/dev/null 2>&1 + if [ $? -eq 0 ]; then + return 0 + fi + + return 1 +} + +# Stop kexec service +stop_kexec_service() { + systemctl stop kexec.service >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "update_flash: Failed to stop kexec service." + error $E_KEXEC "Please stop kexec service and retry." + fi + + echo + echo "info: kexec service stopped." +} + query_support() { local exit_status=$E_UNSUPPORTED @@ -251,6 +281,13 @@ validate_flash() { output="$(cat $PROCVALIDATE)" echo_validate_return_status "$output" + # Check kexec service status + check_kexec_service + if [ $? -eq 0 ]; then + echo + echo "info: kexec service is running. It will be stopped before flashing." + fi + return 0 } @@ -329,6 +366,12 @@ update_flash_from_file() { cat "$OLDPROCFLASH" fi + # Stop kexec service + check_kexec_service + if [ $? -eq 0 ]; then + stop_kexec_service + fi + #XXX reboot -- 2.1.0