|
|
9ae3a8 |
From bfea65d6f229fd65c78ae4daaddf0d0711d0aedd Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 21 Nov 2013 16:27:19 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 09/14] improve debuggability of BLOCK_IO_ERROR / BLOCK_JOB_ERROR (RHEL 6->7 fwd)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1385051239-3677-4-git-send-email-lersek@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55837
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH 3/3] improve debuggability of BLOCK_IO_ERROR / BLOCK_JOB_ERROR (RHEL 6->7 fwd)
|
|
|
9ae3a8 |
Bugzilla: 895041
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=895041
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Forward-port of RHEL-6-only commit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
commit 1a2b98f958fb770b70fa5a244e86c93655400858
|
|
|
9ae3a8 |
Author: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9ae3a8 |
Date: Thu Nov 4 13:51:42 2010 -0200
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
QMP: Improve debuggability of the BLOCK_IO_ERROR event
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Again, the code & docs are extended to BLOCK_JOB_ERROR.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
In the printf() added to bdrv_emit_qmp_error_event() I could have
|
|
|
9ae3a8 |
scavenged the static global "monitor_event_names", but I would have had
|
|
|
9ae3a8 |
to make it extern (or rather add a public getter function), which I deemed
|
|
|
9ae3a8 |
too much.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block.c | 19 +++++++++++++++++++
|
|
|
9ae3a8 |
QMP/qmp-events.txt | 20 ++++++++++++++++++--
|
|
|
9ae3a8 |
2 files changed, 37 insertions(+), 2 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
QMP/qmp-events.txt | 20 ++++++++++++++++++--
|
|
|
9ae3a8 |
block.c | 19 +++++++++++++++++++
|
|
|
9ae3a8 |
2 files changed, 37 insertions(+), 2 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
|
|
|
9ae3a8 |
index c8c6d75..fc4b7db 100644
|
|
|
9ae3a8 |
--- a/QMP/qmp-events.txt
|
|
|
9ae3a8 |
+++ b/QMP/qmp-events.txt
|
|
|
9ae3a8 |
@@ -59,6 +59,11 @@ Data:
|
|
|
9ae3a8 |
"eperm": errno EPERM
|
|
|
9ae3a8 |
"enospc": errno ENOSPC
|
|
|
9ae3a8 |
"eother": any other errno (other than EIO, EPERM, ENOSPC)
|
|
|
9ae3a8 |
+- "__com.redhat_debug_info": RHEL7 extension containing debug information for
|
|
|
9ae3a8 |
+ humans, applications should NOT read any
|
|
|
9ae3a8 |
+ information from this member (json-object):
|
|
|
9ae3a8 |
+ - "errno": errno value (json-int)
|
|
|
9ae3a8 |
+ - "message": error message returned by strerror() (json-string)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Example:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -66,7 +71,10 @@ Example:
|
|
|
9ae3a8 |
"data": { "device": "ide0-hd1",
|
|
|
9ae3a8 |
"operation": "write",
|
|
|
9ae3a8 |
"action": "stop",
|
|
|
9ae3a8 |
- "__com.redhat_reason": "enospc" },
|
|
|
9ae3a8 |
+ "__com.redhat_reason": "enospc",
|
|
|
9ae3a8 |
+ "__com.redhat_debug_info": {
|
|
|
9ae3a8 |
+ "message": "No space left on device",
|
|
|
9ae3a8 |
+ "errno": 28 } }
|
|
|
9ae3a8 |
"timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Note: If action is "stop", a STOP event will eventually follow the
|
|
|
9ae3a8 |
@@ -144,6 +152,11 @@ Data:
|
|
|
9ae3a8 |
"eperm": errno EPERM
|
|
|
9ae3a8 |
"enospc": errno ENOSPC
|
|
|
9ae3a8 |
"eother": any other errno (other than EIO, EPERM, ENOSPC)
|
|
|
9ae3a8 |
+- "__com.redhat_debug_info": RHEL7 extension containing debug information for
|
|
|
9ae3a8 |
+ humans, applications should NOT read any
|
|
|
9ae3a8 |
+ information from this member (json-object):
|
|
|
9ae3a8 |
+ - "errno": errno value (json-int)
|
|
|
9ae3a8 |
+ - "message": error message returned by strerror() (json-string)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Example:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -151,7 +164,10 @@ Example:
|
|
|
9ae3a8 |
"data": { "device": "ide0-hd1",
|
|
|
9ae3a8 |
"operation": "write",
|
|
|
9ae3a8 |
"action": "stop",
|
|
|
9ae3a8 |
- "__com.redhat_reason": "enospc" },
|
|
|
9ae3a8 |
+ "__com.redhat_reason": "enospc",
|
|
|
9ae3a8 |
+ "__com.redhat_debug_info": {
|
|
|
9ae3a8 |
+ "message": "No space left on device",
|
|
|
9ae3a8 |
+ "errno": 28 } }
|
|
|
9ae3a8 |
"timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
BLOCK_JOB_READY
|
|
|
9ae3a8 |
diff --git a/block.c b/block.c
|
|
|
9ae3a8 |
index 68755bf..8ef07bb 100644
|
|
|
9ae3a8 |
--- a/block.c
|
|
|
9ae3a8 |
+++ b/block.c
|
|
|
9ae3a8 |
@@ -1748,6 +1748,18 @@ static void bdrv_put_rhel7_reason(QDict *event, int error)
|
|
|
9ae3a8 |
qdict_put(event, BDRV_REASON_KEY, qstring_from_str(reason));
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+#define BDRV_DEBUG_KEY RFQDN_REDHAT "debug_info"
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+/* RHEL7 vendor extension */
|
|
|
9ae3a8 |
+static void bdrv_put_rhel7_debug_info(QDict *event, int error)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ QObject *info;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ info = qobject_from_jsonf("{ 'errno': %d, 'message': %s }", error,
|
|
|
9ae3a8 |
+ strerror(error));
|
|
|
9ae3a8 |
+ qdict_put_obj(event, BDRV_DEBUG_KEY, info);
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv,
|
|
|
9ae3a8 |
enum MonitorEvent ev,
|
|
|
9ae3a8 |
BlockErrorAction action,
|
|
|
9ae3a8 |
@@ -1771,11 +1783,18 @@ void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv,
|
|
|
9ae3a8 |
abort();
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ fprintf(stderr, "%s error in device '%s': %s (%d)\n",
|
|
|
9ae3a8 |
+ ev == QEVENT_BLOCK_IO_ERROR ? "block I/O" :
|
|
|
9ae3a8 |
+ ev == QEVENT_BLOCK_JOB_ERROR ? "block job" :
|
|
|
9ae3a8 |
+ "other block",
|
|
|
9ae3a8 |
+ bdrv->device_name, strerror(error), error);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
data = qobject_from_jsonf("{ 'device': %s, 'action': %s, 'operation': %s }",
|
|
|
9ae3a8 |
bdrv->device_name,
|
|
|
9ae3a8 |
action_str,
|
|
|
9ae3a8 |
is_read ? "read" : "write");
|
|
|
9ae3a8 |
bdrv_put_rhel7_reason(qobject_to_qdict(data), error);
|
|
|
9ae3a8 |
+ bdrv_put_rhel7_debug_info(qobject_to_qdict(data), error);
|
|
|
9ae3a8 |
monitor_protocol_event(ev, data);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
qobject_decref(data);
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|