From 2c57d3e9cc62f95117d9af0ea0bf9b8783c87147 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 7 Apr 2020 07:40:37 +0000 Subject: [PATCH] [kvmbuild]: print out kvm_log on error Signed-off-by: Guohan Lu --- scripts/build_kvm_image.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/build_kvm_image.sh b/scripts/build_kvm_image.sh index 5a56ac46efce..f9cd9490181d 100755 --- a/scripts/build_kvm_image.sh +++ b/scripts/build_kvm_image.sh @@ -20,8 +20,11 @@ on_exit() rm -f $kvm_log } -kvm_log=$(mktemp) -trap on_exit EXIT +on_error() +{ + echo "============= kvm_log ==============" + cat $kvm_log +} create_disk() { @@ -56,6 +59,10 @@ if [[ "$vs_build_prepare_mem" == "yes" ]]; then free -m fi +kvm_log=$(mktemp) +trap on_exit EXIT +trap on_error ERR + /usr/bin/kvm -m $MEM \ -name "onie" \ -boot "order=cd,once=d" -cdrom "$ONIE_RECOVERY_ISO" \