Browse code

Differentiate between DEFAULT_IMAGE_NAME and filename

The DEFAULT_IMAGE_NAME variable is used to reference the name of the
default image in glance after it has been uploaded by devstack. It is
used both inside and outside of devstack for that purpose. However, when
configuring tempest there are some tests which also do image uploads and
need a filename for specifying which file they should upload into glance
for testing purposes. Previously we were just using DEFAULT_IMAGE_NAME
for both purposes, but this causes a conflict if the name of the image
we upload into glance does not have a file extension. So instead of
conflating the things this commit differentiates between them and adds a
new DEFAULT_IMAGE_FILE_NAME variable to use for this purpose.

Change-Id: Icf74badcf2093d8c75db538232b10b3ac7b86eb8

Matthew Treinish authored on 2017/02/17 05:45:11
Showing 2 changed files
... ...
@@ -11,6 +11,7 @@
11 11
 #   - ``DEST``, ``FILES``
12 12
 #   - ``ADMIN_PASSWORD``
13 13
 #   - ``DEFAULT_IMAGE_NAME``
14
+#   - ``DEFAULT_IMAGE_FILE_NAME``
14 15
 #   - ``S3_SERVICE_PORT``
15 16
 #   - ``SERVICE_HOST``
16 17
 #   - ``BASE_SQL_CONN`` ``lib/database`` declares
... ...
@@ -412,7 +413,7 @@ function configure_tempest {
412 412
         iniset $TEMPEST_CONFIG scenario img_container_format ovf
413 413
     else
414 414
         SCENARIO_IMAGE_DIR=${SCENARIO_IMAGE_DIR:-$FILES}
415
-        SCENARIO_IMAGE_FILE=$DEFAULT_IMAGE_NAME
415
+        SCENARIO_IMAGE_FILE=$DEFAULT_IMAGE_FILE_NAME
416 416
     fi
417 417
     iniset $TEMPEST_CONFIG scenario img_dir $SCENARIO_IMAGE_DIR
418 418
     iniset $TEMPEST_CONFIG scenario img_file $SCENARIO_IMAGE_FILE
... ...
@@ -640,17 +640,21 @@ if [[ "$DOWNLOAD_DEFAULT_IMAGES" == "True" ]]; then
640 640
             case "$LIBVIRT_TYPE" in
641 641
                 lxc) # the cirros root disk in the uec tarball is empty, so it will not work for lxc
642 642
                     DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-rootfs}
643
-                    IMAGE_URLS+="http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-rootfs.img.gz";;
643
+                    DEFAULT_IMAGE_FILE_NAME=${DEFAULT_IMAGE_FILE_NAME:-cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-rootfs.img.gz}
644
+                    IMAGE_URLS+="http://download.cirros-cloud.net/${CIRROS_VERSION}/${DEFAULT_IMAGE_FILE_NAME}";;
644 645
                 *) # otherwise, use the qcow image
645
-                    DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img}
646
-                    IMAGE_URLS+="http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img";;
646
+                    DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk}
647
+                    DEFAULT_IMAGE_FILE_NAME=${DEFAULT_IMAGE_FILE_NAME:-cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img}
648
+                    IMAGE_URLS+="http://download.cirros-cloud.net/${CIRROS_VERSION}/${DEFAULT_IMAGE_FILE_NAME}";;
647 649
                 esac
648 650
             ;;
649 651
         vsphere)
650 652
             DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.2-i386-disk.vmdk}
651
-            IMAGE_URLS+="http://partnerweb.vmware.com/programs/vmdkimage/cirros-0.3.2-i386-disk.vmdk";;
653
+            DEFAULT_IMAGE_FILE_NAME=${DEFAULT_IMAGE_FILE_NAME:-$DEFAULT_IMAGE_NAME}
654
+            IMAGE_URLS+="http://partnerweb.vmware.com/programs/vmdkimage/${DEFAULT_IMAGE_FILE_NAME}";;
652 655
         xenserver)
653 656
             DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.4-x86_64-disk}
657
+            DEFAULT_IMAGE_FILE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.4-x86_64-disk.vhd.tgz}
654 658
             IMAGE_URLS+="http://ca.downloads.xensource.com/OpenStack/cirros-0.3.4-x86_64-disk.vhd.tgz"
655 659
             IMAGE_URLS+=",http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-uec.tar.gz";;
656 660
     esac