online bottlenecks soak throughtputs
[releng.git] / jjb / apex / apex-iso-verify.sh
1 #!/bin/bash
2 set -o errexit
3 set -o nounset
4 set -o pipefail
5
6 # log info to console
7 echo "Starting the Apex iso verify."
8 echo "--------------------------------------------------------"
9 echo
10
11 # Must be RPMs/ISO
12 echo "Downloading latest properties file"
13
14 # get the properties file in order to get info regarding artifacts
15 curl --fail -s -o opnfv.properties http://$GS_URL/latest.properties
16
17 # source the file so we get OPNFV vars
18 source opnfv.properties
19
20 if ! rpm -q virt-install > /dev/null; then
21   sudo yum -y install virt-install
22 fi
23
24 # define a clean function
25 rm_apex_iso_verify () {
26 if sudo virsh list --all | grep apex-iso-verify | grep running; then
27     sudo virsh destroy apex-iso-verify
28 fi
29 if sudo virsh list --all | grep apex-iso-verify; then
30     sudo virsh undefine apex-iso-verify
31 fi
32 }
33
34 # Make sure a pre-existing iso-verify isn't there
35 rm_apex_iso_verify
36
37 #make sure there is not an existing console log file for the VM
38 sudo rm -f /var/log/libvirt/qemu/apex-iso-verify-console.log
39
40 # run an install from the iso
41 # This streams a serial console to tcp port 3737 on localhost
42 sudo virt-install -n apex-iso-verify -r 4096 --vcpus 4 --os-variant=rhel7 \
43  --accelerate -v --noautoconsole \
44  --disk path=/var/lib/libvirt/images/apex-iso-verify.qcow2,size=30,format=qcow2 \
45  -l /tmp/apex-iso/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso \
46  --extra-args 'console=ttyS0 console=ttyS0,115200n8 serial inst.ks=file:/iso-verify.ks inst.stage2=hd:LABEL=OPNFV\x20CentOS\x207\x20x86_64:/' \
47  --initrd-inject ci/iso-verify.ks \
48  --serial file,path=/var/log/libvirt/qemu/apex-iso-verify-console.log
49
50 echo "Waiting for install to finish..."
51 sleep 10
52 end_time=$(($SECONDS+1500))
53 while ! [[ `sudo tail -n1 /var/log/libvirt/qemu/apex-iso-verify-console.log` =~ 'Power down' ]]; do
54   if [ $SECONDS -gt $end_time ] || ! sudo virsh list --all | grep apex-iso-verify | grep running > /dev/null; then
55     sudo cat /var/log/libvirt/qemu/apex-iso-verify-console.log
56     sudo virsh list --all
57     echo "Error: Failed to find power down message after install"
58     exit 1
59   fi
60   sleep 10
61 done
62
63 sudo cat /var/log/libvirt/qemu/apex-iso-verify-console.log
64
65 # clean up
66 rm_apex_iso_verify
67
68 echo
69 echo "--------------------------------------------------------"
70 echo "Done!"