upload_image.sh to support streamOptimized disks

The current version of the script will use "preallocated" as the
disk type of a stream optimized disk. This needs to be fixed by
introspecting the createType of the vmdk file.

Closes-Bug: #1275993

Change-Id: I98594acecf26dd1164870f43890254a19ef23fe9
diff --git a/functions b/functions
index 73d65ce..281b676 100644
--- a/functions
+++ b/functions
@@ -1450,7 +1450,7 @@
         # vmdk disk type
         vmdk_create_type="$(head -25 $IMAGE | grep -a -F -m 1 'createType=' $IMAGE)"
         vmdk_create_type="${vmdk_create_type#*\"}"
-        vmdk_create_type="${vmdk_create_type%?}"
+        vmdk_create_type="${vmdk_create_type%\"*}"
 
         descriptor_data_pair_msg="Monolithic flat and VMFS disks "`
                                     `"should use a descriptor-data pair."
@@ -1495,6 +1495,8 @@
                 IMAGE_NAME="${flat_fname}"
             fi
             vmdk_disktype="preallocated"
+        elif [[ "$vmdk_create_type" = "streamOptimized" ]]; then
+            vmdk_disktype="streamOptimized"
         elif [[ -z "$vmdk_create_type" ]]; then
             # *-flat.vmdk provided: attempt to retrieve the descriptor (*.vmdk)
             # to retrieve appropriate metadata
@@ -1533,10 +1535,8 @@
                     vmdk_adapter_type="${vmdk_adapter_type%?}"
                 fi
             fi
-            #TODO(alegendre): handle streamOptimized once supported by the VMware driver.
             vmdk_disktype="preallocated"
         else
-            #TODO(alegendre): handle streamOptimized once supported by the VMware driver.
             vmdk_disktype="preallocated"
         fi