Fix for glance image-create of *.qcow2 and *.img files

Currently *.qcow2 and *.img files in IMAGE_URLS are piped into glance
using zcat, which fails and leaves the image in a perpetual SAVING state.

This change makes only *.img.gz files use zcat.

Change-Id: I6e02ccff93a42bbc149d8f1058bba7825c910e05
diff --git a/stack.sh b/stack.sh
index ccbbc6b..3221a6c 100755
--- a/stack.sh
+++ b/stack.sh
@@ -2177,6 +2177,8 @@
         RAMDISK=""
         DISK_FORMAT=""
         CONTAINER_FORMAT=""
+        UNPACK=""
+        
         case "$IMAGE_FNAME" in
             *.tar.gz|*.tgz)
                 # Extract ami and aki files
@@ -2208,6 +2210,7 @@
                 IMAGE_NAME=$(basename "$IMAGE" ".img.gz")
                 DISK_FORMAT=raw
                 CONTAINER_FORMAT=bare
+                UNPACK=zcat
                 ;;
             *.qcow2)
                 IMAGE="$FILES/${IMAGE_FNAME}"
@@ -2219,7 +2222,11 @@
         esac
 
         if [ "$CONTAINER_FORMAT" = "bare" ]; then
-            glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < <(zcat --force "${IMAGE}")
+            if [ "$UNPACK" = "zcat" ]; then
+                glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT <  <(zcat --force "${IMAGE}")
+            else
+                glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < ${IMAGE}
+            fi
         else
             # Use glance client to add the kernel the root filesystem.
             # We parse the results of the first upload to get the glance ID of the