7 echo "Starting the Apex iso verify."
8 echo "--------------------------------------------------------"
11 if [ "$BRANCH" == 'master' ]; then
12 echo "Skipping Apex iso verify for master branch"
17 echo "Downloading latest properties file"
19 # get the properties file in order to get info regarding artifacts
20 curl --fail -s -o opnfv.properties http://$GS_URL/latest.properties
22 # source the file so we get OPNFV vars
23 source opnfv.properties
25 if ! rpm -q virt-install > /dev/null; then
26 sudo yum -y install virt-install
29 # define a clean function
30 rm_apex_iso_verify () {
31 if sudo virsh list --all | grep apex-iso-verify | grep running; then
32 sudo virsh destroy apex-iso-verify
34 if sudo virsh list --all | grep apex-iso-verify; then
35 sudo virsh undefine apex-iso-verify
39 # Make sure a pre-existing iso-verify isn't there
42 #make sure there is not an existing console log file for the VM
43 sudo rm -f /var/log/libvirt/qemu/apex-iso-verify-console.log
45 # run an install from the iso
46 # This streams a serial console to tcp port 3737 on localhost
47 sudo virt-install -n apex-iso-verify -r 4096 --vcpus 4 --os-variant=rhel7 \
48 --accelerate -v --noautoconsole \
49 --disk path=/var/lib/libvirt/images/apex-iso-verify.qcow2,size=30,format=qcow2 \
50 -l /tmp/apex-iso/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso \
51 --extra-args 'console=ttyS0 console=ttyS0,115200n8 serial inst.ks=file:/iso-verify.ks inst.stage2=hd:LABEL=OPNFV\x20CentOS\x207\x20x86_64:/' \
52 --initrd-inject ci/iso-verify.ks \
53 --serial file,path=/var/log/libvirt/qemu/apex-iso-verify-console.log
55 echo "Waiting for install to finish..."
57 end_time=$(($SECONDS+1500))
58 while ! [[ `sudo tail -n1 /var/log/libvirt/qemu/apex-iso-verify-console.log` =~ 'Power down' ]]; do
59 if [ $SECONDS -gt $end_time ] || ! sudo virsh list --all | grep apex-iso-verify | grep running > /dev/null; then
60 sudo cat /var/log/libvirt/qemu/apex-iso-verify-console.log
62 echo "Error: Failed to find power down message after install"
68 sudo cat /var/log/libvirt/qemu/apex-iso-verify-console.log
74 echo "--------------------------------------------------------"