From da02e05ff4c956c19a08762fa0df8a16f712fa6a Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Sat, 25 May 2013 06:24:08 -0700 Subject: [PATCH] Fix fedora element to work with qcow2 images. The images from mattdm were updated and also changed to qcow2 format. Change-Id: I6560f177baa9a0e2d303364a3ad4eb216f1f2136 --- elements/fedora/root.d/10-fedora-cloud-image | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/elements/fedora/root.d/10-fedora-cloud-image b/elements/fedora/root.d/10-fedora-cloud-image index ffc4c33d..14e4ac72 100755 --- a/elements/fedora/root.d/10-fedora-cloud-image +++ b/elements/fedora/root.d/10-fedora-cloud-image @@ -12,7 +12,7 @@ fi IMG_PATH=~/.cache/image-create DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://mattdm.fedorapeople.org/cloud-images/} DIB_RELEASE=${DIB_RELEASE:-Fedora18} -BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-Cloud-$ARCH-latest.raw.tar.xz} +BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-Cloud-$ARCH-latest.qcow2} BASE_IMAGE_TAR=$DIB_RELEASE-Cloud-$ARCH-latest.tgz mkdir -p $IMG_PATH @@ -28,8 +28,10 @@ if [ ! -f $IMG_PATH/$BASE_IMAGE_TAR ] ; then EACTION="rm -r $WORKING" trap "$EACTION" EXIT echo "Working in $WORKING" - tar -xJC $WORKING -f $IMG_PATH/$BASE_IMAGE_FILE - LOOPDEV=$(sudo losetup --show -r -f $WORKING/*.raw) + RAW_FILE=$(basename $BASE_IMAGE_FILE) + RAW_FILE=${RAW_FILE#.qcow2}.raw + qemu-img convert -f qcow2 -O raw $IMG_PATH/$BASE_IMAGE_FILE $WORKING/$RAW_FILE + LOOPDEV=$(sudo losetup --show -r -f $WORKING/$RAW_FILE) EACTION="sudo losetup -d $LOOPDEV;$EACTION" trap "$EACTION" EXIT sudo partprobe $LOOPDEV