From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S76zD-0000B6-BA for qemu-devel@nongnu.org; Mon, 12 Mar 2012 11:16:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S76z5-0005Ne-5M for qemu-devel@nongnu.org; Mon, 12 Mar 2012 11:16:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S76z4-0005NT-UL for qemu-devel@nongnu.org; Mon, 12 Mar 2012 11:16:27 -0400 From: Kevin Wolf Date: Mon, 12 Mar 2012 16:19:36 +0100 Message-Id: <1331565591-8414-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1331565591-8414-1-git-send-email-kwolf@redhat.com> References: <1331565591-8414-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 05/20] qcow2: Add error messages in qcow2_truncate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@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"); -- 1.7.6.5