From b52b560fb05102312361a1ce47d71a5de5c19e94 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 30 Oct 2019 09:27:18 +1100 Subject: [PATCH] Revert "Drop vhdutil dependency, use qemu-img" This reverts commit a3e9e7f89e1059ae09296177f147346c7eda4cf3. We still have some issues with vhd creation on RAX In short, it appears that images fail to resize unless they have a specific "creator" field. Revert this while we consider the options. [1] https://bugs.launchpad.net/nova/+bug/862653 Change-Id: I2b6a3bfbfe28432fbb6a2ce4a0211939d224b8d5 --- diskimage_builder/lib/disk-image-create | 8 ++++++-- diskimage_builder/lib/img-functions | 7 ++++++- releasenotes/notes/qemu-img-for-vhd-90141590b5dbf77c.yaml | 6 ------ 3 files changed, 12 insertions(+), 9 deletions(-) delete mode 100644 releasenotes/notes/qemu-img-for-vhd-90141590b5dbf77c.yaml diff --git a/diskimage_builder/lib/disk-image-create b/diskimage_builder/lib/disk-image-create index 1a9b8392..1de310cb 100644 --- a/diskimage_builder/lib/disk-image-create +++ b/diskimage_builder/lib/disk-image-create @@ -100,6 +100,10 @@ function show_options () { echo echo "NOTE: At least one distribution root element must be specified." echo + echo "NOTE: If using the VHD output format you need to have a patched version of vhd-util installed for the image" + echo " to be bootable. The patch is available here: https://github.com/emonty/vhd-util/blob/master/debian/patches/citrix" + echo " and a PPA with the patched tool is available here: https://launchpad.net/~openstack-ci-core/+archive/ubuntu/vhd-util" + echo echo "Examples:" if [ "$IS_RAMDISK" == "0" ]; then echo " ${SCRIPTNAME} -a amd64 -o ubuntu-amd64 vm ubuntu" @@ -265,8 +269,8 @@ for X in ${!IMAGE_TYPES[@]}; do IMAGE_TYPES+=('tar') ;; vhd) - if ! type qemu-img > /dev/null 2>&1; then - echo "vhd output format specified but no qemu-img executable found." + if ! type vhd-util > /dev/null 2>&1; then + echo "vhd output format specified but no vhd-util executable found." exit 1 fi ;; diff --git a/diskimage_builder/lib/img-functions b/diskimage_builder/lib/img-functions index 5f38926d..fa75d7c9 100644 --- a/diskimage_builder/lib/img-functions +++ b/diskimage_builder/lib/img-functions @@ -147,7 +147,12 @@ function compress_and_save_image () { $DIB_GZIP_BIN -9 < $IMAGE_NAME.tar > $1-new rm $IMAGE_NAME.tar elif [ "$IMAGE_TYPE" == "vhd" ]; then - qemu-img convert $TMP_IMAGE_PATH -O vpc -o subformat=dynamic $1-new + cp $TMP_IMAGE_PATH $1-intermediate + vhd-util convert -s 0 -t 1 -i $1-intermediate -o $1-intermediate + vhd-util convert -s 1 -t 2 -i $1-intermediate -o $1-new + # The previous command creates a .bak file + rm $1-intermediate.bak + OUT_IMAGE_PATH=$1-new else echo "Converting image using qemu-img convert" qemu-img convert ${COMPRESS_IMAGE:+-c} -f raw -O $IMAGE_TYPE $EXTRA_OPTIONS $TMP_IMAGE_PATH $1-new diff --git a/releasenotes/notes/qemu-img-for-vhd-90141590b5dbf77c.yaml b/releasenotes/notes/qemu-img-for-vhd-90141590b5dbf77c.yaml deleted file mode 100644 index 65f869a5..00000000 --- a/releasenotes/notes/qemu-img-for-vhd-90141590b5dbf77c.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -upgrade: - - | - Generation of VHD (VPC/Microsoft Virtual PC/Rackspace) images is - now done via qemu-img, rather than the externally patched - ``vhdutil`` package which is no longer maintained.