Skip to content

Commit

Permalink
provision: add print_debug_log function in vm-image-builder
Browse files Browse the repository at this point in the history
Signed-off-by: howard zhang <howard.zhang@arm.com>
  • Loading branch information
zhlhahaha committed Jul 21, 2023
1 parent 934a634 commit d7fb4ba
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cluster-provision/images/vm-image-builder/customize-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@ ARCH=${ARCHITECTURE:-"$(go_style_local_arch)"}
CONSOLE=${CONSOLE:-"true"}
DEBUG=${DEBUG:-"false"}

function print_debug_log() {
local debuglog="/tmp/provision-vm-console.log /var/log/libvirtd.log /var/log/virtlogd.log /var/log/swtpm/libvirt/qemu/provision-vm-swtpm.log"
for i in `ls /var/log/libvirt/qemu/`; do
debuglog="${debuglog} /var/log/libvirt/qemu/${i}"
done
for log in ${debuglog}; do
printf "*%.0s" {1..15}
echo "print ${log}"
cat ${log}
done
}

function cleanup() {
if [ $? -ne 0 ]; then
rm -f "${CUSTOMIZE_IMAGE_PATH}"
fi

if [[ ${DEBUG} = "true" ]]; then
cat /tmp/provision-vm-console.log
print_debug_log
fi

virsh destroy "${DOMAIN_NAME}" || true
Expand Down Expand Up @@ -76,7 +88,7 @@ virt-install \
${consoleconfig}

if [[ ${DEBUG} = "true" ]]; then
cat /tmp/provision-vm-console.log
print_debug_log
fi

# Stop VM
Expand Down

0 comments on commit d7fb4ba

Please sign in to comment.