qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jack Schwartz <jack.schwartz@oracle.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, armbru@redhat.com,
	eblake@redhat.com, karl.heubaum@oracle.com,
	konrad.wilk@oracle.com
Subject: [Qemu-devel] [PATCH v1 1/1] block: Add numeric errno field to BLOCK_IO_ERROR events
Date: Thu, 21 Dec 2017 16:11:36 -0800	[thread overview]
Message-ID: <1513901496-13538-2-git-send-email-jack.schwartz@oracle.com> (raw)
In-Reply-To: <1513901496-13538-1-git-send-email-jack.schwartz@oracle.com>

BLOCK_IO_ERROR events currently contain a "reason" string which is
strerror(errno) of the error.  This enhancement provides those events with
the numeric errno value as well, since it is easier to parse for error type
than a string.

Signed-off-by: Jack Schwartz <jack.schwartz@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
---
 block/block-backend.c |  2 +-
 qapi/block-core.json  | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index baef8e7..f628668 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1572,7 +1572,7 @@ static void send_qmp_error_event(BlockBackend *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 == ENOSPC, error, strerror(error),
                                    &error_abort);
 }
 
diff --git a/qapi/block-core.json b/qapi/block-core.json
index a8cdbc3..b7beca7 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -3660,6 +3660,11 @@
 #           io-status is present, please see query-block documentation
 #           for more information (since: 2.2)
 #
+# @errno: int describing the error cause, provided for applications.
+#         (Note: while most errnos are posix compliant between OSs, it
+#         is possible some errno values can vary among different OSs.)
+#         (since 2.12)
+#
 # @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)
@@ -3675,14 +3680,17 @@
 #      "data": { "device": "ide0-hd1",
 #                "node-name": "#block212",
 #                "operation": "write",
-#                "action": "stop" },
+#                "action": "stop",
+#                "nospace": false,
+#                "errno": 5,
+#                "reason": "Input/output error" },
 #      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
 #
 ##
 { 'event': 'BLOCK_IO_ERROR',
   'data': { 'device': 'str', 'node-name': 'str', 'operation': 'IoOperationType',
             'action': 'BlockErrorAction', '*nospace': 'bool',
-            'reason': 'str' } }
+            'errno': 'int', 'reason': 'str' } }
 
 ##
 # @BLOCK_JOB_COMPLETED:
-- 
1.8.3.1

  reply	other threads:[~2017-12-22  0:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22  0:11 [Qemu-devel] [PATCH v1 0/1] block: Add numeric errno field to BLOCK_IO_ERROR events Jack Schwartz
2017-12-22  0:11 ` Jack Schwartz [this message]
2017-12-22  1:08   ` [Qemu-devel] [PATCH v1 1/1] " Eric Blake
2017-12-22  1:15     ` [Qemu-devel] [Qemu-block] " Eric Blake
2017-12-22 13:52   ` [Qemu-devel] " Kevin Wolf
2018-01-08 19:57     ` Jack Schwartz
2018-01-09 10:24       ` Kevin Wolf
2018-01-10 21:28         ` Jack Schwartz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513901496-13538-2-git-send-email-jack.schwartz@oracle.com \
    --to=jack.schwartz@oracle.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=karl.heubaum@oracle.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).