diff options
-rw-r--r-- | ci/config_functest.yaml | 5 | ||||
-rwxr-xr-x | testcases/OpenStack/healthcheck/healthcheck.sh | 42 |
2 files changed, 43 insertions, 4 deletions
diff --git a/ci/config_functest.yaml b/ci/config_functest.yaml index 24c7084f2..953d69023 100644 --- a/ci/config_functest.yaml +++ b/ci/config_functest.yaml @@ -37,7 +37,7 @@ general: image_name: Cirros-0.3.4 image_file_name: cirros-0.3.4-x86_64-disk.img image_disk_format: qcow2 - + # Private network for functest. Will be created by config_functest.py neutron_private_net_name: functest-net neutron_private_subnet_name: functest-subnet @@ -47,6 +47,9 @@ general: neutron_private_subnet_gateway: 192.168.120.254 neutron_router_name: functest-router +healthcheck: + disk_image: /home/opnfv/functest/data/cirros-0.3.4-x86_64-disk.img + vping: ping_timeout: 200 vm_flavor: m1.small # adapt to your environment 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!" |