CoreOS cloud image is compressed with bz2 extension [1]. In such
case, we need to decompress the image before uploading it to glance.
[1] https://coreos.com/os/docs/latest/booting-on-openstack.html
Change-Id: I705d0813d180aefaa2507c00d1ae40af07d12fcf
... | ... |
@@ -295,6 +295,12 @@ function upload_image { |
295 | 295 |
container_format=bare |
296 | 296 |
unpack=zcat |
297 | 297 |
;; |
298 |
+ *.img.bz2) |
|
299 |
+ image_name=$(basename "$image" ".img.bz2") |
|
300 |
+ disk_format=qcow2 |
|
301 |
+ container_format=bare |
|
302 |
+ unpack=bunzip2 |
|
303 |
+ ;; |
|
298 | 304 |
*.qcow2) |
299 | 305 |
image_name=$(basename "$image" ".qcow2") |
300 | 306 |
disk_format=qcow2 |
... | ... |
@@ -328,6 +334,8 @@ function upload_image { |
328 | 328 |
if [ "$container_format" = "bare" ]; then |
329 | 329 |
if [ "$unpack" = "zcat" ]; then |
330 | 330 |
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}") |
331 |
+ elif [ "$unpack" = "bunzip2" ]; then |
|
332 |
+ 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}") |
|
331 | 333 |
else |
332 | 334 |
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}" |
333 | 335 |
fi |