From 748b183ff97ad7ad259a76dcef348a7b2c2fc00a Mon Sep 17 00:00:00 2001 From: Ciprian Barbu Date: Mon, 25 Jul 2016 14:43:00 +0300 Subject: Add configure options for healthcheck The healthcheck tier used hard-coded x86 image for testing glance and nova. This breaks functest for ARM based pods, because x86 instances cannot run on ARM and even more, if healthcheck fails no other testcases are executed. Change-Id: I8a4cc754569a26d98bff57470574ed28eebbf2da Signed-off-by: Ciprian Barbu --- testcases/OpenStack/healthcheck/healthcheck.sh | 42 ++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'testcases/OpenStack/healthcheck') diff --git a/testcases/OpenStack/healthcheck/healthcheck.sh b/testcases/OpenStack/healthcheck/healthcheck.sh index b890477db..2449ac93b 100755 --- a/testcases/OpenStack/healthcheck/healthcheck.sh +++ b/testcases/OpenStack/healthcheck/healthcheck.sh @@ -18,6 +18,7 @@ set -e #Redirect all the output (stdout) to a log file and show only possible errors. LOG_FILE=/home/opnfv/functest/results/healthcheck.log +YAML_FILE=${CONFIG_FUNCTEST_YAML} echo "">$LOG_FILE exec 1<>$LOG_FILE @@ -54,6 +55,8 @@ user_3="opnfv_user3" user_4="opnfv_user4" user_5="opnfv_user5" user_6="opnfv_user6" +kernel_image="opnfv-kernel-img" +ramdisk_image="opnfv-ramdisk-img" image_1="opnfv-image1" image_2="opnfv-image2" volume_1="opnfv-volume1" @@ -116,10 +119,43 @@ info "...Keystone OK!" ################################# info "Testing Glance API..." ################################# -image=/home/opnfv/functest/data/cirros-0.3.4-x86_64-disk.img -glance image-create --name ${image_1} --disk-format qcow2 --container-format bare < ${image} +disk_img=$(cat ${YAML_FILE} | shyaml get-value healthcheck.disk_image 2> /dev/null || true) +kernel_img=$(cat ${YAML_FILE} | shyaml get-value healthcheck.kernel_image 2> /dev/null || true) +ramdisk_img=$(cat ${YAML_FILE} | shyaml get-value healthcheck.ramdisk_image 2> /dev/null || true) +extra_properties=$(cat ${YAML_FILE} | shyaml get-value healthcheck.extra_properties 2> /dev/null || true) + +# Test if we need to create a 3part image +if [ "X$kernel_img" != "X" ] +then + img_id=$(glance image-create --name ${kernel_image} --disk-format aki \ + --container-format bare < ${kernel_img} | awk '$2 == "id" { print $4 }') + extra_opts="--property kernel_id=${img_id}" + + if [ "X$ramdisk_img" != "X" ] + then + img_id=$(glance image-create --name ${ramdisk_image} --disk-format ari \ + --container-format bare < ${ramdisk_img} | awk '$2 == "id" { print $4 }') + extra_opts="$extra_opts --property ramdisk_id=${img_id}" + fi +fi + +if [ "X$extra_properties" != "X" ] +then + keys=$(cat ${YAML_FILE} | shyaml keys healthcheck.extra_properties) + for key in ${keys} + do + value=$(cat ${YAML_FILE} | shyaml get-value healthcheck.extra_properties.${key}) + extra_opts="$extra_opts --property ${key}=\"${value}\"" + done +fi + +debug "image extra_properties=${extra_properties}" + +eval glance image-create --name ${image_1} --disk-format qcow2 --container-format bare \ + ${extra_opts} < ${disk_img} debug "image '${image_1}' created." -glance image-create --name ${image_2} --disk-format qcow2 --container-format bare < ${image} +eval glance image-create --name ${image_2} --disk-format qcow2 --container-format bare \ + ${extra_opts} < ${disk_img} debug "image '${image_2}' created." info "... Glance OK!" -- cgit 1.2.3-korg