From e043f87775b14cdcc472e968b29c7d5f02873b7a Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Mon, 4 Dec 2017 20:02:19 +0300 Subject: [PATCH] build-vm, pack: implement qcow2c support This is a compressed version of good ol' qcow2. Suggested-by: Alexey Shabalin --- features.in/build-vm/lib/90-build-vm.mk | 6 ++++-- features.in/pack/config.mk | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/features.in/build-vm/lib/90-build-vm.mk b/features.in/build-vm/lib/90-build-vm.mk index 0210d811..ba4ba43f 100644 --- a/features.in/build-vm/lib/90-build-vm.mk +++ b/features.in/build-vm/lib/90-build-vm.mk @@ -33,16 +33,18 @@ prepare-image: check-sudo fi convert-image: prepare-image - @case "$(IMAGE_TYPE)" in \ + @VM_COMPRESS=; \ + case "$(IMAGE_TYPE)" in \ "img") mv "$(VM_RAWDISK)" "$(IMAGE_OUTPATH)"; exit 0;; \ "vhd") VM_FORMAT="vpc";; \ + "qcow2c") VM_FORMAT="qcow2"; VM_COMPRESS="-c";; \ *) VM_FORMAT="$(IMAGE_TYPE)"; \ esac; \ if ! type -t qemu-img >&/dev/null; then \ echo "** error: qemu-img not available" >&2; \ exit 1; \ else \ - qemu-img convert -O "$$VM_FORMAT" \ + qemu-img convert $$VM_COMPRESS -O "$$VM_FORMAT" \ "$(VM_RAWDISK)" "$(IMAGE_OUTPATH)"; \ rm "$(VM_RAWDISK)"; \ if [ "0$(DEBUG)" -le 1 ]; then rm "$(VM_TARBALL)"; fi; \ diff --git a/features.in/pack/config.mk b/features.in/pack/config.mk index a70736f4..e86698d0 100644 --- a/features.in/pack/config.mk +++ b/features.in/pack/config.mk @@ -40,6 +40,6 @@ $(foreach c,$(VE_ARCHIVES), \ $(eval $(call PACK_compressors,$(c),$(z))))) # virtual machines -VM_EXTS := .img .qcow2 .vdi .vmdk .vhd +VM_EXTS := .img .qcow2 .qcow2c .vdi .vmdk .vhd $(VM_EXTS:.%=use/pack/%): use/pack; @: