From patchwork Thu Sep 11 14:25:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 388281 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E280D1400E6 for ; Fri, 12 Sep 2014 00:26:25 +1000 (EST) Received: from localhost ([::1]:38842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS5KJ-0002nm-QE for incoming@patchwork.ozlabs.org; Thu, 11 Sep 2014 10:26:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS5Jx-0002VO-7s for qemu-devel@nongnu.org; Thu, 11 Sep 2014 10:26:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XS5Jr-00018H-0G for qemu-devel@nongnu.org; Thu, 11 Sep 2014 10:26:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29776) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS5Jq-00017u-OL for qemu-devel@nongnu.org; Thu, 11 Sep 2014 10:25:54 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8BEPpAx029398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 11 Sep 2014 10:25:51 -0400 Received: from localhost (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8BEPmN3029294; Thu, 11 Sep 2014 10:25:49 -0400 Date: Thu, 11 Sep 2014 10:25:48 -0400 From: Luiz Capitulino To: kwolf@redhat.com Message-ID: <20140911102548.3a270709@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: fromani@redhat.com, armbru@redhat.com, qemu-devel Subject: [Qemu-devel] [PATCH] block: extend BLOCK_IO_ERROR with reason string 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 BLOCK_IO_ERROR events are logged by libvirt, which helps with post mortem analysis of guests. However, one information that we miss today is a human readable string describing the cause of the I/O error. This commit adds that string it to BLOCK_IO_ERROR. Note that this string is a debugging aid for humans, meaning that it should not parsed by applications. Signed-off-by: Luiz Capitulino Reviewed-by: Eric Blake --- This patch applies on top of the following patch: [PATCH] block: extend BLOCK_IO_ERROR event with nospace indicator Which has been submitted some time ago and is already applied in the block tree. block.c | 3 ++- qapi/block-core.json | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 460effe..3c9fb33 100644 --- a/block.c +++ b/block.c @@ -3648,7 +3648,8 @@ static void send_qmp_error_event(BlockDriverState *bs, ac = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE; qapi_event_send_block_io_error(bdrv_get_device_name(bs), ac, action, bdrv_iostatus_is_enabled(bs), - error == ENOSPC, &error_abort); + error == ENOSPC, strerror(error), + &error_abort); } /* This is done by device models because, while the block layer knows diff --git a/qapi/block-core.json b/qapi/block-core.json index 68945c2..4064d5b 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1593,6 +1593,10 @@ # io-status is present, please see query-block documentation # for more information (since: 2.2) # +# @reason: human readable string describing the error cause. +# (This field is a debugging aid for humans, it should not +# be parsed by applications) (since: 2.2) +# # Note: If action is "stop", a STOP event will eventually follow the # BLOCK_IO_ERROR event # @@ -1600,7 +1604,8 @@ ## { 'event': 'BLOCK_IO_ERROR', 'data': { 'device': 'str', 'operation': 'IoOperationType', - 'action': 'BlockErrorAction', '*nospace': 'bool' } } + 'action': 'BlockErrorAction', '*nospace': 'bool', + 'reason': 'str' } } ## # @BLOCK_JOB_COMPLETED