|
...
|
...
|
@@ -1256,7 +1256,25 @@ function upload_image() {
|
|
1256
|
1256
|
if [[ "$image_url" =~ '.vmdk' ]]; then
|
|
1257
|
1257
|
IMAGE="$FILES/${IMAGE_FNAME}"
|
|
1258
|
1258
|
IMAGE_NAME="${IMAGE_FNAME%.vmdk}"
|
|
1259
|
|
- glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format bare --disk-format vmdk --property vmware-disktype="preallocated" < "${IMAGE}"
|
|
|
1259
|
+
|
|
|
1260
|
+ # Before we can upload vmdk type images to glance, we need to know it's
|
|
|
1261
|
+ # disk type, storage adapter, and networking adapter. These values are
|
|
|
1262
|
+ # passed to glance as custom properties. We take these values from the
|
|
|
1263
|
+ # vmdk filename, which is expected in the following format:
|
|
|
1264
|
+ #
|
|
|
1265
|
+ # <name>-<disk type>:<storage adapter>:<network adapter>
|
|
|
1266
|
+ #
|
|
|
1267
|
+ # If the filename does not follow the above format then the vsphere
|
|
|
1268
|
+ # driver will supply default values.
|
|
|
1269
|
+ property_string=`echo "$IMAGE_NAME" | grep -oP '(?<=-)(?!.*-).+:.+:.+$'`
|
|
|
1270
|
+ if [[ ! -z "$property_string" ]]; then
|
|
|
1271
|
+ IFS=':' read -a props <<< "$property_string"
|
|
|
1272
|
+ vmdk_disktype="${props[0]}"
|
|
|
1273
|
+ vmdk_adapter_type="${props[1]}"
|
|
|
1274
|
+ vmdk_net_adapter="${props[2]}"
|
|
|
1275
|
+ fi
|
|
|
1276
|
+
|
|
|
1277
|
+ glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format bare --disk-format vmdk --property vmware-disktype="$vmdk_disktype" --property vmware_adaptertype="$vmdk_adapter_type" --property hw_vif_model="$vmdk_net_adapter" < "${IMAGE}"
|
|
1260
|
1278
|
return
|
|
1261
|
1279
|
fi
|
|
1262
|
1280
|
|