Support upload of qcow2.xz image format
Some images come in *.xz format [1] and this needs to be uncompressed before being uploaded. [1] https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/31.20200323.3.2/x86_64/fedora-coreos-31.20200323.3.2-openstack.x86_64.qcow2.xz Change-Id: I11f8484ba939c4b2c0a98aa08ef7db730baf71e8
This commit is contained in:
parent
1a6c22e489
commit
f70cb70acb
16
functions
16
functions
@ -341,6 +341,12 @@ function upload_image {
|
||||
disk_format=qcow2
|
||||
container_format=bare
|
||||
;;
|
||||
*.qcow2.xz)
|
||||
image_name=$(basename "$image" ".qcow2.xz")
|
||||
disk_format=qcow2
|
||||
container_format=bare
|
||||
unpack=unxz
|
||||
;;
|
||||
*.raw)
|
||||
image_name=$(basename "$image" ".raw")
|
||||
disk_format=raw
|
||||
@ -376,6 +382,16 @@ function upload_image {
|
||||
openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < <(zcat --force "${image}")
|
||||
elif [ "$unpack" = "bunzip2" ]; then
|
||||
openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < <(bunzip2 -cdk "${image}")
|
||||
elif [ "$unpack" = "unxz" ]; then
|
||||
# NOTE(brtknr): unxz the file first and cleanup afterwards to
|
||||
# prevent timeout while Glance tries to upload image (e.g. to Swift).
|
||||
local tmp_dir
|
||||
local image_path
|
||||
tmp_dir=$(mktemp -d)
|
||||
image_path="$tmp_dir/$image_name"
|
||||
unxz -cv "${image}" > "$image_path"
|
||||
openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format --file "$image_path"
|
||||
rm -rf $tmp_dir
|
||||
else
|
||||
openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < "${image}"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user