From 38ed9a39becd7fff6104b43518d187b33447f3a4 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Mon, 17 Jul 2023 11:07:52 +0300 Subject: [PATCH] Start collecting logs from virt-install --- test/cases/installers.sh | 7 ++++++- test/cases/minimal-raw.sh | 12 +++++++++++- test/cases/oscap.sh | 10 ++++++++-- tools/libvirt_test.sh | 18 ++++++++++++++---- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/test/cases/installers.sh b/test/cases/installers.sh index e95396239..53e7c4b85 100755 --- a/test/cases/installers.sh +++ b/test/cases/installers.sh @@ -355,6 +355,10 @@ sudo qemu-img create -f qcow2 "${LIBVIRT_IMAGE_PATH}" 20G ######################### # Install image via anaconda. +VIRT_LOG="$ARTIFACTS/installers-sh-virt-install-console.log" +touch "$VIRT_LOG" +sudo chown qemu:qemu "$VIRT_LOG" + greenprint "💿 Install image via installer(ISO) on VM" sudo virt-install --name="${IMAGE_KEY}"\ --disk path="${LIBVIRT_IMAGE_PATH}",format=qcow2 \ @@ -367,7 +371,8 @@ sudo virt-install --name="${IMAGE_KEY}"\ --nographics \ --noautoconsole \ --wait=-1 \ - --noreboot + --noreboot \ + --console pipe,source.path="$VIRT_LOG" # Start VM. diff --git a/test/cases/minimal-raw.sh b/test/cases/minimal-raw.sh index 3fbee574f..03da4531f 100755 --- a/test/cases/minimal-raw.sh +++ b/test/cases/minimal-raw.sh @@ -283,6 +283,14 @@ sudo composer-cli blueprints delete minimal-raw > /dev/null greenprint "👿 Running restorecon on image directory" sudo restorecon -Rv /var/lib/libvirt/images/ +# create artifacts folder +ARTIFACTS="${ARTIFACTS:=/tmp/artifacts}" +mkdir -p "${ARTIFACTS}" + +VIRT_LOG="$ARTIFACTS/minimal-raw-virt-install-console.log" +touch "$VIRT_LOG" +sudo chown qemu:qemu "$VIRT_LOG" + ################################################################## ## ## Install and test minimal-raw image (UEFI) @@ -300,7 +308,9 @@ sudo virt-install --name="${IMAGE_KEY}-uefi"\ --noautoconsole \ --wait=-1 \ --import \ - --noreboot + --noreboot \ + --console pipe,source.path="$VIRT_LOG" + # Start VM. greenprint "💻 Start UEFI VM" diff --git a/test/cases/oscap.sh b/test/cases/oscap.sh index a25aa8630..7ce92a861 100755 --- a/test/cases/oscap.sh +++ b/test/cases/oscap.sh @@ -59,7 +59,8 @@ EOF TEST_UUID=$(uuidgen) IMAGE_KEY="oscap-${TEST_UUID}" HTTP_GUEST_ADDRESS=192.168.100.50 -ARTIFACTS="ci-artifacts" +# create artifacts folder +ARTIFACTS="${ARTIFACTS:=/tmp/artifacts}" mkdir -p "${ARTIFACTS}" # Set up temporary files. @@ -303,6 +304,10 @@ sudo restorecon -Rv /var/lib/libvirt/images/ greenprint "💿 Creating a cloud-init ISO" gen_iso +VIRT_LOG="$ARTIFACTS/oscap-sh-virt-install-console.log" +touch "$VIRT_LOG" +sudo chown qemu:qemu "$VIRT_LOG" + greenprint "📋 Install baseline image" VIRSH_DOMAIN="${IMAGE_KEY}-baseline" sudo virt-install --name="${VIRSH_DOMAIN}"\ @@ -317,7 +322,8 @@ sudo virt-install --name="${VIRSH_DOMAIN}"\ --noautoconsole \ --nographics \ --wait=15 \ - --noreboot + --noreboot \ + --console pipe,source.path="$VIRT_LOG" # Installation can get stuck, destroying VM helps # See https://github.com/osbuild/osbuild-composer/issues/2413 diff --git a/tools/libvirt_test.sh b/tools/libvirt_test.sh index ec97d26a3..46eb92106 100755 --- a/tools/libvirt_test.sh +++ b/tools/libvirt_test.sh @@ -95,6 +95,12 @@ ARTIFACTS="${ARTIFACTS:-/tmp/artifacts}" SSH_DATA_DIR=$(/usr/libexec/osbuild-composer-test/gen-ssh.sh) SSH_KEY=${SSH_DATA_DIR}/id_rsa +VIRT_LOG="$ARTIFACTS/libvirt_tests-virt-install-console.log" +if [ ! -f "$VIRT_LOG" ]; then + touch "$VIRT_LOG" +fi +sudo chown qemu:qemu "$VIRT_LOG" + # Check for the smoke test file on the AWS instance that we start. smoke_test_check () { # Ensure the ssh key has restricted permissions. @@ -255,7 +261,8 @@ if [[ $ARCH == 'ppc64le' ]]; then --os-variant rhel8-unknown \ --noautoconsole \ --network network=integration,mac=34:49:22:B0:83:30 \ - --qemu-commandline="-machine pseries,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off,cap-large-decr=off" + --qemu-commandline="-machine pseries,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off,cap-large-decr=off" \ + --console pipe,source.path="$VIRT_LOG" elif [[ $ARCH == 's390x' ]]; then # Our s390x machines are highly constrained on resources. sudo virt-install \ @@ -267,7 +274,8 @@ elif [[ $ARCH == 's390x' ]]; then --import \ --os-variant rhel8-unknown \ --noautoconsole \ - --network network=integration,mac=34:49:22:B0:83:30 + --network network=integration,mac=34:49:22:B0:83:30 \ + --console pipe,source.path="$VIRT_LOG" else case "${ID}-${VERSION_ID}" in "rhel-8"*) @@ -314,7 +322,8 @@ else --os-variant "${OS_VARIANT}" \ --noautoconsole \ --boot uefi,"${NVRAM_TEMPLATE}" \ - --network network=integration,mac=34:49:22:B0:83:30 + --network network=integration,mac=34:49:22:B0:83:30 \ + --console pipe,source.path="$VIRT_LOG" else sudo virt-install \ --name "$IMAGE_KEY" \ @@ -325,7 +334,8 @@ else --import \ --os-variant "${OS_VARIANT}" \ --noautoconsole \ - --network network=integration,mac=34:49:22:B0:83:30 + --network network=integration,mac=34:49:22:B0:83:30 \ + --console pipe,source.path="$VIRT_LOG" fi fi