Browse code

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

Arnaud Legendre authored on 2014/02/04 10:57:39
Showing 1 changed files
... ...
@@ -1450,7 +1450,7 @@ function upload_image() {
1450 1450
         # vmdk disk type
1451 1451
         vmdk_create_type="$(head -25 $IMAGE | grep -a -F -m 1 'createType=' $IMAGE)"
1452 1452
         vmdk_create_type="${vmdk_create_type#*\"}"
1453
-        vmdk_create_type="${vmdk_create_type%?}"
1453
+        vmdk_create_type="${vmdk_create_type%\"*}"
1454 1454
 
1455 1455
         descriptor_data_pair_msg="Monolithic flat and VMFS disks "`
1456 1456
                                     `"should use a descriptor-data pair."
... ...
@@ -1495,6 +1495,8 @@ function upload_image() {
1495 1495
                 IMAGE_NAME="${flat_fname}"
1496 1496
             fi
1497 1497
             vmdk_disktype="preallocated"
1498
+        elif [[ "$vmdk_create_type" = "streamOptimized" ]]; then
1499
+            vmdk_disktype="streamOptimized"
1498 1500
         elif [[ -z "$vmdk_create_type" ]]; then
1499 1501
             # *-flat.vmdk provided: attempt to retrieve the descriptor (*.vmdk)
1500 1502
             # to retrieve appropriate metadata
... ...
@@ -1533,10 +1535,8 @@ function upload_image() {
1533 1533
                     vmdk_adapter_type="${vmdk_adapter_type%?}"
1534 1534
                 fi
1535 1535
             fi
1536
-            #TODO(alegendre): handle streamOptimized once supported by the VMware driver.
1537 1536
             vmdk_disktype="preallocated"
1538 1537
         else
1539
-            #TODO(alegendre): handle streamOptimized once supported by the VMware driver.
1540 1538
             vmdk_disktype="preallocated"
1541 1539
         fi
1542 1540