|
...
|
...
|
@@ -341,6 +341,12 @@ function upload_image {
|
|
341
|
341
|
disk_format=qcow2
|
|
342
|
342
|
container_format=bare
|
|
343
|
343
|
;;
|
|
|
344
|
+ *.qcow2.xz)
|
|
|
345
|
+ image_name=$(basename "$image" ".qcow2.xz")
|
|
|
346
|
+ disk_format=qcow2
|
|
|
347
|
+ container_format=bare
|
|
|
348
|
+ unpack=unxz
|
|
|
349
|
+ ;;
|
|
344
|
350
|
*.raw)
|
|
345
|
351
|
image_name=$(basename "$image" ".raw")
|
|
346
|
352
|
disk_format=raw
|
|
...
|
...
|
@@ -376,6 +382,16 @@ function upload_image {
|
|
376
|
376
|
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}")
|
|
377
|
377
|
elif [ "$unpack" = "bunzip2" ]; then
|
|
378
|
378
|
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}")
|
|
|
379
|
+ elif [ "$unpack" = "unxz" ]; then
|
|
|
380
|
+ # NOTE(brtknr): unxz the file first and cleanup afterwards to
|
|
|
381
|
+ # prevent timeout while Glance tries to upload image (e.g. to Swift).
|
|
|
382
|
+ local tmp_dir
|
|
|
383
|
+ local image_path
|
|
|
384
|
+ tmp_dir=$(mktemp -d)
|
|
|
385
|
+ image_path="$tmp_dir/$image_name"
|
|
|
386
|
+ unxz -cv "${image}" > "$image_path"
|
|
|
387
|
+ 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"
|
|
|
388
|
+ rm -rf $tmp_dir
|
|
379
|
389
|
else
|
|
380
|
390
|
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}"
|
|
381
|
391
|
fi
|