summaryrefslogtreecommitdiffstats
path: root/xci/scripts
diff options
context:
space:
mode:
authorMarkos Chandras <mchandras@suse.de>2017-09-28 07:43:34 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-28 07:43:34 +0000
commita9ec5d588eaeece632ad9f0e5f27b7313a291d6a (patch)
tree7ea1ee4e660e4e6227afe4321c057e9abead3593 /xci/scripts
parent7056b91177bcfb2f745cbb3d4c6e55005c59b9c7 (diff)
parent44cdd0b1462530977b3efae4ac9d17dcb6c4c12c (diff)
Merge changes from topic 'fix-vm-on-jenkins'
* changes: xci: scripts: start-new-vm.sh: Fix paths for default XCI test xci: Replace ANSIBLE_VERBOSITY with XCI_ANSIBLE_VERBOSITY xci: scripts: start-new-vm.sh: Print dib output when running on CI xci: scripts: start-new-vm.sh: Use 'unsafe' cache for the clean vm disk xci: xci-deploy.sh: Make sure all local Ansible installations are gone xci: scripts: start-new-vm.sh: Do not allow multiple build-dib-os processes
Diffstat (limited to 'xci/scripts')
-rwxr-xr-xxci/scripts/vm/start-new-vm.sh22
1 files changed, 18 insertions, 4 deletions
diff --git a/xci/scripts/vm/start-new-vm.sh b/xci/scripts/vm/start-new-vm.sh
index c374071c..65133edc 100755
--- a/xci/scripts/vm/start-new-vm.sh
+++ b/xci/scripts/vm/start-new-vm.sh
@@ -38,8 +38,22 @@ declare -r BASE_PATH=$(dirname $(readlink -f $0) | sed "s@/xci/.*@@")
echo "Preparing new virtual machine '${NAME}'..."
# NOTE(hwoarang) This should be removed when we move the dib images to a central place
+_retries=20
echo "Building '${OS}' image (tail build.log for progress and failures)..."
-$BASE_PATH/xci/scripts/vm/build-dib-os.sh ${OS} > build.log 2>&1
+while [[ $_retries -ne 0 ]]; do
+ if pgrep build-dib-os.sh &>/dev/null; then
+ echo "There is another dib process running... ($_retries retries left)"
+ sleep 60
+ (( _retries = _retries - 1 ))
+ else
+ if [[ -n ${JENKINS_HOME} ]]; then
+ $BASE_PATH/xci/scripts/vm/build-dib-os.sh ${OS} 2>&1 | tee build.log
+ else
+ $BASE_PATH/xci/scripts/vm/build-dib-os.sh ${OS} > build.log 2>&1
+ fi
+ break
+ fi
+done
[[ ! -e ${OS}.qcow2 ]] && echo "${OS}.qcow2 not found! This should never happen!" && exit 1
@@ -78,7 +92,7 @@ sudo virsh undefine ${NAME} || true
echo "Installing virtual machine '${NAME}'..."
sudo virt-install -n ${NAME} --memory ${MEMORY} --vcpus ${NCPUS} --cpu ${CPU} \
- --import --disk=${OS}.qcow2 --network network=${NETWORK} \
+ --import --disk=${OS}.qcow2,cache=unsafe --network network=${NETWORK} \
--graphics none --hvm --noautoconsole
_retries=30
@@ -177,7 +191,7 @@ set +e
_has_test=true
echo "Verifying test script exists..."
-$vm_ssh $_ip "bash -c 'stat ~/$(basename ${BASE_PATH})/run_jenkins_test.sh'"
+$vm_ssh $_ip "bash -c 'stat ~/releng-xci/run_jenkins_test.sh'"
if [[ $? != 0 ]]; then
echo "Failed to find a 'run_jenkins_test.sh' script..."
if ${DEFAULT_XCI_TEST}; then
@@ -196,7 +210,7 @@ fi
if ${_has_test}; then
echo "Running test..."
- $vm_ssh $_ip "bash ~/$(basename ${BASE_PATH})/run_jenkins_test.sh"
+ $vm_ssh $_ip "bash ~/releng-xci/run_jenkins_test.sh"
xci_error=$?
else
echo "No jenkins test was found. The virtual machine will remain idle!"