From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHIhp-0006Q6-TW for qemu-devel@nongnu.org; Fri, 21 Oct 2011 13:16:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RHIho-0002fc-91 for qemu-devel@nongnu.org; Fri, 21 Oct 2011 13:16:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHIho-0002fO-1G for qemu-devel@nongnu.org; Fri, 21 Oct 2011 13:16:28 -0400 From: Kevin Wolf Date: Fri, 21 Oct 2011 19:19:07 +0200 Message-Id: <1319217556-28273-11-git-send-email-kwolf@redhat.com> In-Reply-To: <1319217556-28273-1-git-send-email-kwolf@redhat.com> References: <1319217556-28273-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 10/19] qemu-img: Don't allow preallocation and compression at the same time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org Only qcow and qcow2 can do compression at all, and they require unallocated clusters when writing the compressed data. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- qemu-img.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 6a39731..86127f0 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -824,6 +824,8 @@ static int img_convert(int argc, char **argv) if (compress) { QEMUOptionParameter *encryption = get_option_parameter(param, BLOCK_OPT_ENCRYPT); + QEMUOptionParameter *preallocation = + get_option_parameter(param, BLOCK_OPT_PREALLOC); if (!drv->bdrv_write_compressed) { error_report("Compression not supported for this file format"); @@ -837,6 +839,15 @@ static int img_convert(int argc, char **argv) ret = -1; goto out; } + + if (preallocation && preallocation->value.s + && strcmp(preallocation->value.s, "off")) + { + error_report("Compression and preallocation not supported at " + "the same time"); + ret = -1; + goto out; + } } /* Create the new image */ -- 1.7.6.4