Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

WIP: iso-sanity: New test for ISO installs #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions iso-sanity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Run `virt-install` to install an ISO using both BIOS and EFI.
43 changes: 43 additions & 0 deletions iso-sanity/check-iso-sanity.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -xeuo pipefail
ISO=$1
shift
dn=$(dirname $0)

tempdir=$(mktemp -d /var/tmp/isosanity.XXXXX)
function cleanup () {
fusermount -u ${tempdir}/mnt || true
rm "${tempdir}" -rf
}
trap cleanup EXIT

export LIBGUESTFS_BACKEND=direct
mkdir ${tempdir}/mnt
guestmount --ro -a ${ISO} -m /dev/sda1 ${tempdir}/mnt
(cd ${tmpdir}/mnt && python -m SimpleHTTPServer 0 >../httpd.txt)
success=false
# FIXME - detect from libvirt/define our own?
hostip=192.168.122.1
for x in $(seq 30); do
sed -e s',Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${tempdir}/httpd.txt > ${tempdir}/port.txt
if cmp ${tempdir}/httpd.txt ${tempdir}/port.txt; then
port=$(tr -d '\n' < ${tempdir}/port.txt)
if curl "http://${hostip}:${port}"; then
success=true
break
fi
fi
sleep 0.1
done
if !${success}; then
echo "Failed to wait for http server"
exit 1
fi

# --initrd-inject ${dn}/default.ks --extra-args=inst.ks=file:/default.ks
base_args="--ram 3192 --vcpus 4 --disk size=20 --os-variant rhel7 --location http://${hostip}:${port}/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm guessing we don't have to specify a ks here because anaconda automatically falls back on the default one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do need the above bits, but this was me trying to debug why it doesn't work even if we don't inject a kickstart. That appears to be an anaconda behavioral change when booted from ISO vs network.


virsh -c qemu:///system undefine isosanity-efi || true
virt-install ${base_args} --name isosanity-efi --boot uefi
virsh -c qemu:///system undefine isosanity-bios || true
virt-install ${base_args} --name isosanity-bios
1 change: 1 addition & 0 deletions iso-sanity/default.ks
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%include /usr/share/anaconda/interactive-defaults.ks