From patchwork Tue Mar 6 11:48:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 144928 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4A15EB7059 for ; Tue, 6 Mar 2012 22:45:21 +1100 (EST) Received: from localhost ([::1]:34971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4spP-0007tT-Fo for incoming@patchwork.ozlabs.org; Tue, 06 Mar 2012 06:45:15 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4sot-0007n5-Q3 for qemu-devel@nongnu.org; Tue, 06 Mar 2012 06:45:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4soo-0005cV-V8 for qemu-devel@nongnu.org; Tue, 06 Mar 2012 06:44:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4soo-0005cF-Mf for qemu-devel@nongnu.org; Tue, 06 Mar 2012 06:44:38 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q26BibF1003108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 6 Mar 2012 06:44:37 -0500 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q26BiZm4002439; Tue, 6 Mar 2012 06:44:36 -0500 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Tue, 6 Mar 2012 12:48:08 +0100 Message-Id: <1331034488-12288-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com Subject: [Qemu-devel] [PATCH] qcow2: Add error messages in qcow2_truncate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org qemu-img resize has some limitations with qcow2, but the user is only told that "this image format does not support resize". Quite confusing, so add some more detailed error_report() calls and change "this image format" into "this image". Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block/qcow2.c | 3 +++ qemu-img.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 6f53ec6..7aece65 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1120,16 +1120,19 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset) int ret, new_l1_size; if (offset & 511) { + error_report("The new size must be a multiple of 512"); return -EINVAL; } /* cannot proceed if image has snapshots */ if (s->nb_snapshots) { + error_report("Can't resize an image which has snapshots"); return -ENOTSUP; } /* shrinking is currently not supported */ if (offset < bs->total_sectors * 512) { + error_report("qcow2 doesn't support shrinking images yet"); return -ENOTSUP; } diff --git a/qemu-img.c b/qemu-img.c index 8df3564..0e48b35 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1614,7 +1614,7 @@ static int img_resize(int argc, char **argv) printf("Image resized.\n"); break; case -ENOTSUP: - error_report("This image format does not support resize"); + error_report("This image does not support resize"); break; case -EACCES: error_report("Image is read-only");