From e434225f9bec6f078f5514c82c9406131122a49e Mon Sep 17 00:00:00 2001 From: Vladyslav Drok Date: Tue, 14 Jun 2016 20:16:55 +0300 Subject: [PATCH] Change the logic of selecting image for tests Right now devstack sets DEFAULT_IMAGE_NAME depending on the driver in stackrc. UUID of the image with this name is then written to tempest config during tempest configuration stage and is used to determine which image will be used during nova boot. As ironic python agent now supports both whole disk and partition images, we should change this logic, and the user should be able to request which image should be used in tests. This commit adds IRONIC_TEMPEST_WHOLE_DISK_IMAGE and IRONIC_IMAGE_NAME variables to provide this possibility. If IRONIC_TEMPEST_WHOLE_DISK_IMAGE is not set, we try to infer the image type by the size of the ephemeral partition requested, if it is 0, we consider the image to be whole disk. Change-Id: Ic718a6b37c09ae564ecc3913cf31234316f1da63 --- devstack/lib/ironic | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index c22f8516dd..85b00e4f8e 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -148,6 +148,18 @@ IRONIC_DEPLOY_RAMDISK=${IRONIC_DEPLOY_RAMDISK:-} IRONIC_DEPLOY_KERNEL=${IRONIC_DEPLOY_KERNEL:-} IRONIC_DEPLOY_ISO=${IRONIC_DEPLOY_ISO:-} +# These parameters describe which image will be used to provision a node in +# tempest tests +if [[ -z "$IRONIC_TEMPEST_WHOLE_DISK_IMAGE" && "$IRONIC_VM_EPHEMERAL_DISK" == 0 ]]; then + IRONIC_TEMPEST_WHOLE_DISK_IMAGE=True +fi +IRONIC_TEMPEST_WHOLE_DISK_IMAGE=$(trueorfalse False IRONIC_TEMPEST_WHOLE_DISK_IMAGE) +if [[ "$IRONIC_TEMPEST_WHOLE_DISK_IMAGE" == "True" ]]; then + IRONIC_IMAGE_NAME=${IRONIC_IMAGE_NAME:-cirros-${CIRROS_VERSION}-x86_64-disk} +else + IRONIC_IMAGE_NAME=${IRONIC_IMAGE_NAME:-cirros-${CIRROS_VERSION}-x86_64-uec} +fi + # NOTE(jroll) this needs to be updated when stable branches are cut IPA_DOWNLOAD_BRANCH=${IPA_DOWNLOAD_BRANCH:-master} IPA_DOWNLOAD_BRANCH=$(echo $IPA_DOWNLOAD_BRANCH | tr / -) @@ -1409,6 +1421,11 @@ function ironic_configure_tempest { if [[ -n "${IRONIC_PROVISION_NETWORK_NAME}" ]]; then iniset $TEMPEST_CONFIG baremetal use_provision_network True fi + + local image_uuid + image_uuid=$(openstack image show $IRONIC_IMAGE_NAME -f value -c id) + iniset $TEMPEST_CONFIG compute image_ref $image_uuid + iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid } # Restore xtrace + pipefail