Use pre-cached images for tests (or pre-cache prior to testing)

Cirros downloads have been a big problem of unreliability in testing
Packstack in different environments.

This aims to use pre-cached Cirros image files (in OpenStack or RDO
gate) or it will download the images with wget (with retries) prior
to running the tests.

This will prove faster if there are pre-cached images available
and more reliable in case the images need to be downloaded.

The change is backwards compatible and affects testing from
run_tests.sh only. The glance_image provider from puppet-glance
accepts files or URLs, detecting if it's a path by leading slashes
in from the location.
The *_URL parameters are arguably no longer accurate but this can
be fixed in a future patch if we see the need to.

Change-Id: Ibd19fb69e080957165594953687efe5f096f93b2
(cherry picked from commit a6c5f9d1de)
This commit is contained in:
David Moreau-Simard 2016-08-17 13:27:40 -04:00
parent 0eb12f3366
commit bdf8ddb8bc
4 changed files with 30 additions and 0 deletions

View File

@ -85,11 +85,32 @@ $SUDO yum -y install puppet \
ruby-devel \
openstack-selinux \
policycoreutils \
wget \
"@Development Tools"
# Don't assume pip is installed
which pip || $SUDO easy_install pip
# Try to use pre-cached cirros images, if available, otherwise download them
rm -rf /tmp/cirros
mkdir /tmp/cirros
if [ -f ~/cache/files/cirros-0.3.4-x86_64-uec.tar.gz ]; then
tar -xzvf ~/cache/files/cirros-0.3.4-x86_64-uec.tar.gz -C /tmp/cirros/
else
echo "No pre-cached uec archive found, downloading..."
wget --tries=10 http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-uec.tar.gz -P /tmp/cirros/
tar -xzvf /tmp/cirros/cirros-0.3.4-x86_64-uec.tar.gz -C /tmp/cirros/
fi
if [ -f ~/cache/files/cirros-0.3.4-x86_64-disk.img ]; then
cp -p ~/cache/files/cirros-0.3.4-x86_64-disk.img /tmp/cirros/
else
echo "No pre-cached disk image found, downloading..."
wget --tries=10 http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img -P /tmp/cirros/
fi
echo "Using pre-cached images:"
find /tmp/cirros -type f -printf "%m %n %u %g %s %t" -exec md5sum \{\} \;
# TO-DO: Packstack should handle Hiera and Puppet configuration, so that it works
# no matter the environment
$SUDO su -c 'cat > /etc/puppet/puppet.conf <<EOF

View File

@ -25,6 +25,9 @@ $SUDO packstack --allinone \
--os-swift-install=n \
--os-manila-install=y \
--glance-backend=file \
--provision-uec-kernel-url="/tmp/cirros/cirros-0.3.4-x86_64-vmlinuz" \
--provision-uec-ramdisk-url="/tmp/cirros/cirros-0.3.4-x86_64-initrd" \
--provision-uec-disk-url="/tmp/cirros/cirros-0.3.4-x86_64-disk.img" \
--provision-demo=y \
--provision-tempest=y \
--run-tempest=y \

View File

@ -28,6 +28,9 @@ $SUDO packstack --allinone \
--glance-backend=swift \
--os-sahara-install=y \
--os-trove-install=y \
--provision-uec-kernel-url="/tmp/cirros/cirros-0.3.4-x86_64-vmlinuz" \
--provision-uec-ramdisk-url="/tmp/cirros/cirros-0.3.4-x86_64-initrd" \
--provision-uec-disk-url="/tmp/cirros/cirros-0.3.4-x86_64-disk.img" \
--provision-demo=y \
--provision-tempest=y \
--run-tempest=y \

View File

@ -24,6 +24,9 @@ $SUDO packstack --allinone \
--os-horizon-install=n \
--glance-backend=file \
--os-heat-install=y \
--provision-uec-kernel-url="/tmp/cirros/cirros-0.3.4-x86_64-vmlinuz" \
--provision-uec-ramdisk-url="/tmp/cirros/cirros-0.3.4-x86_64-initrd" \
--provision-uec-disk-url="/tmp/cirros/cirros-0.3.4-x86_64-disk.img" \
--provision-demo=y \
--provision-tempest=y \
--run-tempest=y \