Generate heat images for tempest tests

This requires HEAT_CREATE_TEST_IMAGE to be set for any images
to be created.

If the file (files/fedora-vm-heat-cfntools-tempest.qcow2) already
exists then disk-image-create will not be called, and the existing
image file will be registered with glance. This is most likely to
happen in the following scenarios:
- a second run of stack.sh
- the image has been pre-built elsewhere (such as during devstack-gate
  image building)
Change-Id: I276573a20927e72f2cb68784f655c1ba1913ae8a
diff --git a/lib/tempest b/lib/tempest
index aaa7281..5142f24 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -24,6 +24,7 @@
 # ``DEFAULT_INSTANCE_TYPE``
 # ``DEFAULT_INSTANCE_USER``
 # ``CINDER_MULTI_LVM_BACKEND``
+# ``HEAT_CREATE_TEST_IMAGE``
 # ``stack.sh`` calls the entry points in this order:
 #
 # install_tempest
@@ -271,6 +272,12 @@
     iniset $TEMPEST_CONF boto http_socket_timeout 30
     iniset $TEMPEST_CONF boto ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
 
+    # Orchestration test image
+    if [ $HEAT_CREATE_TEST_IMAGE == "True" ]; then
+        disk_image_create /usr/share/tripleo-image-elements "vm fedora heat-cfntools" "i386" "fedora-vm-heat-cfntools-tempest"
+        iniset $TEMPEST_CONF orchestration image_ref "fedora-vm-heat-cfntools-tempest"
+    fi
+
     # Scenario
     iniset $TEMPEST_CONF scenario img_dir "$FILES/images/cirros-0.3.1-x86_64-uec"