From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrYdp-0002By-Hx for qemu-devel@nongnu.org; Mon, 02 Jun 2014 16:15:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrYdj-0007wt-65 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 16:15:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrYdi-0007wi-UR for qemu-devel@nongnu.org; Mon, 02 Jun 2014 16:15:27 -0400 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 s52KFOpj004554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 2 Jun 2014 16:15:25 -0400 From: Max Reitz Date: Mon, 2 Jun 2014 22:15:21 +0200 Message-Id: <1401740121-15506-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v2] qemu-img: Document check exit codes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Markus Armbruster , Stefan Hajnoczi , Max Reitz The exit code 63 (check not supported by image format) was not even documented in the comment above the check command in the source code; add it, as it does indeed seem useful. Also, document all of check's exit codes in the manpage. Signed-off-by: Max Reitz Reported-by: Markus Armbruster Reviewed-by: Eric Blake --- v2: Fixed spelling mistakes [Eric] --- qemu-img.c | 9 +++++---- qemu-img.texi | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index b3d2bc6..aa89ba2 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -580,10 +580,11 @@ static int collect_image_check(BlockDriverState *bs, /* * Checks an image for consistency. Exit codes: * - * 0 - Check completed, image is good - * 1 - Check not completed because of internal errors - * 2 - Check completed, image is corrupted - * 3 - Check completed, image has leaked clusters, but is good otherwise + * 0 - Check completed, image is good + * 1 - Check not completed because of internal errors + * 2 - Check completed, image is corrupted + * 3 - Check completed, image has leaked clusters, but is good otherwise + * 63 - Checks are not supported by the image format */ static int img_check(int argc, char **argv) { diff --git a/qemu-img.texi b/qemu-img.texi index f84590e..c68b541 100644 --- a/qemu-img.texi +++ b/qemu-img.texi @@ -126,6 +126,29 @@ wrong fix or hiding corruption that has already occurred. Only the formats @code{qcow2}, @code{qed} and @code{vdi} support consistency checks. +In case the image does not have any inconsistencies, check exits with @code{0}. +Other exit codes indicate the kind of inconsistency found or if another error +occurred. The following table summarizes all exit codes of the check subcommand: + +@table @option + +@item 0 +Check completed, the image is (now) consistent +@item 1 +Check not completed because of internal errors +@item 2 +Check completed, image is corrupted +@item 3 +Check completed, image has leaked clusters, but is not corrupted +@item 63 +Checks are not supported by the image format + +@end table + +If @code{-r} is specified, exit codes representing the image state refer to the +state after (the attempt at) repairing it. That is, a successful @code{-r all} +will yield the exit code 0, independently of the image state before. + @item create [-f @var{fmt}] [-o @var{options}] @var{filename} [@var{size}] Create the new disk image @var{filename} of size @var{size} and format -- 1.9.3