From 30fca662bc4a22abef0add5662c720c0ed6e1dd7 Mon Sep 17 00:00:00 2001 From: Bartosz Bezak Date: Thu, 7 Sep 2023 16:25:33 +0200 Subject: [PATCH] CI: add q35 hardware machine type to tests Change-Id: If9636aaa76a7dc094223c3f096d96c96ecd0c8e7 --- tests/test-core-openstack.sh | 53 +++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/tests/test-core-openstack.sh b/tests/test-core-openstack.sh index cbe61666e4..e43e2450f2 100755 --- a/tests/test-core-openstack.sh +++ b/tests/test-core-openstack.sh @@ -257,6 +257,14 @@ function detach_fip { openstack server remove floating ip ${instance_name} ${fip_addr} } +function set_cirros_image_q35_machine_type { + openstack image set --property hw_machine_type=q35 cirros +} + +function unset_cirros_image_q35_machine_type { + openstack image unset --property hw_machine_type cirros +} + function test_ssh { local instance_name=$1 local fip_addr=$2 @@ -280,6 +288,14 @@ function test_ssh { function test_instance_boot { local fip_addr + local machine_type="${1}" + local fip_file="/tmp/kolla_ci_pre_upgrade_fip_addr${machine_type:+_$machine_type}" + local upgrade_instance_name="kolla_upgrade_test${machine_type:+_$machine_type}" + local volume_name="durable_volume${machine_type:+_$machine_type}" + + if [[ $machine_type == "q35" ]]; then + set_cirros_image_q35_machine_type + fi echo "TESTING: Server creation" create_instance kolla_boot_test @@ -314,12 +330,12 @@ function test_instance_boot { echo "TESTING: Cinder volume upgrade stability (PHASE: $PHASE)" if [[ $PHASE == 'deploy' ]]; then - create_a_volume durable_volume - openstack volume show durable_volume + create_a_volume $volume_name + openstack volume show $volume_name elif [[ $PHASE == 'upgrade' ]]; then - openstack volume show durable_volume - attach_and_detach_a_volume durable_volume kolla_boot_test - delete_a_volume durable_volume + openstack volume show $volume_name + attach_and_detach_a_volume $volume_name kolla_boot_test + delete_a_volume $volume_name fi echo "SUCCESS: Cinder volume upgrade stability (PHASE: $PHASE)" @@ -377,21 +393,25 @@ function test_instance_boot { echo "TESTING: Instance (Nova and Neutron) upgrade stability (PHASE: $PHASE)" if [[ $PHASE == 'deploy' ]]; then - create_instance kolla_upgrade_test + create_instance $upgrade_instance_name fip_addr=$(create_fip) - attach_fip kolla_upgrade_test ${fip_addr} - test_ssh kolla_upgrade_test ${fip_addr} # tested to see if the instance has not just failed booting already - echo ${fip_addr} > /tmp/kolla_ci_pre_upgrade_fip_addr + attach_fip $upgrade_instance_name ${fip_addr} + test_ssh $upgrade_instance_name ${fip_addr} # tested to see if the instance has not just failed booting already + echo ${fip_addr} > $fip_file elif [[ $PHASE == 'upgrade' ]]; then - fip_addr=$(cat /tmp/kolla_ci_pre_upgrade_fip_addr) - test_ssh kolla_upgrade_test ${fip_addr} - detach_fip kolla_upgrade_test ${fip_addr} + fip_addr=$(cat $fip_file) + test_ssh $upgrade_instance_name ${fip_addr} + detach_fip $upgrade_instance_name ${fip_addr} delete_fip ${fip_addr} - delete_instance kolla_upgrade_test + delete_instance $upgrade_instance_name fi echo "SUCCESS: Instance (Nova and Neutron) upgrade stability (PHASE: $PHASE)" fi + + if [[ $machine_type == "q35" ]]; then + unset_cirros_image_q35_machine_type + fi } function test_openstack_logged { @@ -399,6 +419,13 @@ function test_openstack_logged { . ~/openstackclient-venv/bin/activate test_smoke test_instance_boot + + # Check for x86_64 architecture to run q35 tests + if [[ $(uname -m) == "x86_64" ]]; then + set_cirros_image_q35_machine_type + test_instance_boot q35 + unset_cirros_image_q35_machine_type + fi } function test_openstack {