Merge "Update vsphere image filename pattern"
This commit is contained in:
commit
1fe3fc0457
26
functions
26
functions
@ -1392,11 +1392,15 @@ function upload_image() {
|
||||
# We take these values from the vmdk file if populated. Otherwise, we use
|
||||
# vmdk filename, which is expected in the following format:
|
||||
#
|
||||
# <name>-<disk type>:<storage adapter>:<network adapter>
|
||||
# <name>-<disk type>;<storage adapter>;<network adapter>
|
||||
#
|
||||
# If the filename does not follow the above format then the vsphere
|
||||
# driver will supply default values.
|
||||
|
||||
vmdk_adapter_type=""
|
||||
vmdk_disktype=""
|
||||
vmdk_net_adapter=""
|
||||
|
||||
# vmdk adapter type
|
||||
vmdk_adapter_type="$(head -25 $IMAGE | grep -a -F -m 1 'ddb.adapterType =' $IMAGE)"
|
||||
vmdk_adapter_type="${vmdk_adapter_type#*\"}"
|
||||
@ -1415,17 +1419,15 @@ function upload_image() {
|
||||
#TODO(alegendre): handle streamOptimized once supported by VMware driver.
|
||||
vmdk_disktype="preallocated"
|
||||
fi
|
||||
property_string=`echo "$IMAGE_NAME" | grep -oP '(?<=-)(?!.*-).+:.+:.+$'`
|
||||
if [[ ! -z "$property_string" ]]; then
|
||||
IFS=':' read -a props <<< "$property_string"
|
||||
if [[ ! -z "${props[0]}" ]]; then
|
||||
vmdk_disktype="${props[0]}"
|
||||
fi
|
||||
if [[ ! -z "${props[1]}" ]]; then
|
||||
vmdk_adapter_type="${props[1]}"
|
||||
fi
|
||||
vmdk_net_adapter="${props[2]}"
|
||||
fi
|
||||
|
||||
# NOTE: For backwards compatibility reasons, colons may be used in place
|
||||
# of semi-colons for property delimiters but they are not permitted
|
||||
# characters in NTFS filesystems.
|
||||
property_string=`echo "$IMAGE_NAME" | grep -oP '(?<=-)(?!.*-).+[:;].+[:;].+$'`
|
||||
IFS=':;' read -a props <<< "$property_string"
|
||||
vmdk_disktype="${props[0]:-$vmdk_disktype}"
|
||||
vmdk_adapter_type="${props[1]:-$vmdk_adapter_type}"
|
||||
vmdk_net_adapter="${props[2]:-$vmdk_net_adapter}"
|
||||
|
||||
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}"
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user