Download a compressed centos cloud images
The centos cloud images are both arround a GB in size, and downloading them causes lot of CI timeouts, downloading the compressed version saves 700MB of bandwith and should save a lot of time. Change-Id: I8dcd1db81fe5c4661945638ef3e6344fdf651243
This commit is contained in:
parent
5bae00db0c
commit
fadb613e78
@ -24,7 +24,7 @@ if [ -n "$DIB_LOCAL_IMAGE" ]; then
|
||||
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
|
||||
else
|
||||
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/6/images}
|
||||
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-6-x86_64-$DIB_RELEASE.qcow2}
|
||||
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-6-x86_64-$DIB_RELEASE.qcow2.xz}
|
||||
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
|
||||
IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
|
||||
CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
||||
|
@ -28,7 +28,7 @@ if [ -n "$DIB_LOCAL_IMAGE" ]; then
|
||||
else
|
||||
DIB_RELEASE=${DIB_RELEASE:-GenericCloud}
|
||||
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/7/images}
|
||||
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-7-x86_64-$DIB_RELEASE.qcow2}
|
||||
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-7-x86_64-$DIB_RELEASE.qcow2.xz}
|
||||
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
|
||||
IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
|
||||
CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
||||
|
@ -3,6 +3,13 @@ redhat-common
|
||||
=============
|
||||
Image installation steps common to RHEL, CentOS, and Fedora.
|
||||
|
||||
Requirements:
|
||||
|
||||
If used to build an image form a cloud image compress with xz
|
||||
(the default in centos), this element uses "unxz" to decompress
|
||||
the image. Depending on your distro you may need to install either
|
||||
the xz or xz-utils package.
|
||||
|
||||
Overrides:
|
||||
|
||||
DIB_LOCAL_IMAGE
|
||||
|
@ -50,6 +50,13 @@ function extract_image() {
|
||||
|
||||
RAW_FILE=$(mktemp --tmpdir=$WORKING XXXXXX.raw)
|
||||
|
||||
if [ "${CACHED_IMAGE: -3}" == ".xz" ] ; then
|
||||
QCOW2_FILE=$(mktemp --tmpdir=$WORKING XXXXXX.qcow2)
|
||||
# This leaves the old image in place so cache-url wont get it again
|
||||
unxz --stdout $CACHED_IMAGE > $QCOW2_FILE
|
||||
CACHED_IMAGE=$QCOW2_FILE
|
||||
fi
|
||||
|
||||
qemu-img convert -f qcow2 -O raw $CACHED_IMAGE $RAW_FILE
|
||||
|
||||
ROOT_PARTITON=p$(sudo kpartx -l $RAW_FILE | awk "/loop[0-9]+p/"|wc -l)
|
||||
|
Loading…
Reference in New Issue
Block a user