Received: from eggs.gnu.org ([2001:4830:134:3::10]:36547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsVQf-0007T9-Qh for qemu-devel@nongnu.org; Fri, 07 Oct 2016 09:43:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsVQe-0004KC-P7 for qemu-devel@nongnu.org; Fri, 07 Oct 2016 09:43:13 -0400 From: Kevin Wolf Date: Fri, 7 Oct 2016 15:42:54 +0200 Message-Id: <1475847779-7336-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1475847779-7336-1-git-send-email-kwolf@redhat.com> References: <1475847779-7336-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 05/10] block: Add node name to BLOCK_IO_ERROR event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org The event currently only contains the BlockBackend name. However, with anonymous BlockBackends, this is always the empty string. Add the node name so that the user can still see which block device caused the event. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/block-backend.c | 5 +++-- docs/qmp-events.txt | 8 +++++++- qapi/block-core.json | 10 ++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 11b0d8b..27ddacb 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1197,8 +1197,9 @@ static void send_qmp_error_event(BlockBackend *blk, IoOperationType optype; optype = is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE; - qapi_event_send_block_io_error(blk_name(blk), optype, action, - blk_iostatus_is_enabled(blk), + qapi_event_send_block_io_error(blk_name(blk), + bdrv_get_node_name(blk_bs(blk)), optype, + action, blk_iostatus_is_enabled(blk), error == ENOSPC, strerror(error), &error_abort); } diff --git a/docs/qmp-events.txt b/docs/qmp-events.txt index 7967ec4..62a9f9c 100644 --- a/docs/qmp-events.txt +++ b/docs/qmp-events.txt @@ -65,7 +65,12 @@ Emitted when a disk I/O error occurs. Data: -- "device": device name (json-string) +- "device": device name. This is always present for compatibility + reasons, but it can be empty ("") if the image does not + have a device name associated. (json-string) +- "node-name": node name. Note that errors may be reported for the root node + that is directly attached to a guest device rather than for the + node where the error occurred. (json-string) - "operation": I/O operation (json-string, "read" or "write") - "action": action that has been taken, it's one of the following (json-string): "ignore": error has been ignored @@ -76,6 +81,7 @@ Example: { "event": "BLOCK_IO_ERROR", "data": { "device": "ide0-hd1", + "node-name": "#block212", "operation": "write", "action": "stop" }, "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } diff --git a/qapi/block-core.json b/qapi/block-core.json index 9d797b8..3d3c0be 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2545,7 +2545,13 @@ # # Emitted when a disk I/O error occurs # -# @device: device name +# @device: device name. This is always present for compatibility +# reasons, but it can be empty ("") if the image does not +# have a device name associated. +# +# @node-name: node name. Note that errors may be reported for the root node +# that is directly attached to a guest device rather than for the +# node where the error occurred. (Since: 2.8) # # @operation: I/O operation # @@ -2566,7 +2572,7 @@ # Since: 0.13.0 ## { 'event': 'BLOCK_IO_ERROR', - 'data': { 'device': 'str', 'operation': 'IoOperationType', + 'data': { 'device': 'str', 'node-name': 'str', 'operation': 'IoOperationType', 'action': 'BlockErrorAction', '*nospace': 'bool', 'reason': 'str' } } -- 1.8.3.1