From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=36342 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6OCI-0000vD-Ub for qemu-devel@nongnu.org; Thu, 14 Oct 2010 09:50:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6OCI-0003XV-2D for qemu-devel@nongnu.org; Thu, 14 Oct 2010 09:50:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6OCH-0003WN-RY for qemu-devel@nongnu.org; Thu, 14 Oct 2010 09:50:18 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9EDoGHI018934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 14 Oct 2010 09:50:16 -0400 From: Kevin Wolf Date: Thu, 14 Oct 2010 15:50:52 +0200 Message-Id: <1287064252-18294-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH] qemu-img: Fix qemu-img convert -obacking_file List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com The old -B option caused a backing file to be used for the converted image and to avoid copying clusters from the old backing file. When replaced with -obacking_file, qemu-img convert does assign the backing file to the new image, but it doesn't realize that it should avoid copying clusters from the backing file. This patch checks the -o options for a backing_file and applies the same logic as for -B in this case. Signed-off-by: Kevin Wolf --- qemu-img.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index d4a3b4e..2864cb8 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -645,6 +645,7 @@ static int img_convert(int argc, char **argv) const uint8_t *buf1; BlockDriverInfo bdi; QEMUOptionParameter *param = NULL, *create_options = NULL; + QEMUOptionParameter *out_baseimg_param; char *options = NULL; const char *snapshot_name = NULL; @@ -769,6 +770,12 @@ static int img_convert(int argc, char **argv) goto out; } + /* Get backing file name if -o backing_file was used */ + out_baseimg_param = get_option_parameter(param, BLOCK_OPT_BACKING_FILE); + if (out_baseimg_param) { + out_baseimg = out_baseimg_param->value.s; + } + /* Check if compression is supported */ if (flags & BLOCK_FLAG_COMPRESS) { QEMUOptionParameter *encryption = -- 1.7.2.3