diff --git a/bin/disk-image-create b/bin/disk-image-create index bddfe9f4..43898ff3 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -26,10 +26,12 @@ function show_options () { echo " -a i386|amd64 -- set the architecture of the image" echo " -o filename -- set the name of the output file" echo " -x -- turn on tracing" + echo " -u -- uncompressed; do not compress the image - larger but faster" exit 0 } -TEMP=`getopt -o a:ho:x -n $SCRIPTNAME -- "$@"` +COMPRESS_IMAGE="true" +TEMP=`getopt -o a:ho:xu -n $SCRIPTNAME -- "$@"` echo "XXX $TEMP" if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi @@ -42,6 +44,7 @@ while true ; do -o) export IMAGE_NAME=$2; shift 2 ;; -h) show_options;; -x) shift; set -x;; + -u) shift; export COMPRESS_IMAGE="";; --) shift ; break ;; *) echo "Internal error!" ; exit 1 ;; esac @@ -63,7 +66,7 @@ mk_build_dir ensure_base_available eval_run_d block-device-size "IMAGE_SIZE=" -qemu-img create -f qcow2 $TMP_IMAGE_PATH ${IMAGE_SIZE}G +qemu-img create -f qcow2 -o preallocation=metadata $TMP_IMAGE_PATH ${IMAGE_SIZE}G # Should have a grab-next-dev helper ? NBD_DEV=/dev/nbd0 diff --git a/lib/img-functions b/lib/img-functions index 07c2b504..e2362da5 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -165,7 +165,7 @@ function finalise_base () { function compress_image () { # Recreate our image to throw away unnecessary data - qemu-img convert -c $TMP_IMAGE_PATH -O qcow2 $TMP_IMAGE_PATH-new + qemu-img convert ${COMPRESS_IMAGE:+-c} $TMP_IMAGE_PATH -O qcow2 $TMP_IMAGE_PATH-new rm $TMP_IMAGE_PATH mv $TMP_IMAGE_PATH-new $TMP_IMAGE_PATH }