You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

52 lines
1.9 KiB

From e0e23b17841055a7a5b4e253b516fda248f0f0f5 Mon Sep 17 00:00:00 2001
Message-Id: <e0e23b17841055a7a5b4e253b516fda248f0f0f5@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 9 Oct 2014 10:38:39 +0200
Subject: [PATCH] RHEL: Add support for QMP I/O error reason
RHEL-only
Adds support for __com.redhat_reason on I/O error events. The code will
fallback to upstream nospace boolean if the reason is not present and
complain if neither of these is found.
https://bugzilla.redhat.com/show_bug.cgi?id=1119784
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_monitor_json.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 908e29eac3..ecb2f2dd7d 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -682,7 +682,7 @@ qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr data)
{
const char *device;
const char *action;
- const char *reason = "";
+ const char *reason;
bool nospc = false;
int actionID;
@@ -698,8 +698,14 @@ qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr data)
if ((device = virJSONValueObjectGetString(data, "device")) == NULL)
VIR_WARN("missing device in disk io error event");
- if (virJSONValueObjectGetBoolean(data, "nospace", &nospc) == 0 && nospc)
- reason = "enospc";
+ reason = virJSONValueObjectGetString(data, "__com.redhat_reason");
+ if (!reason) {
+ if (virJSONValueObjectGetBoolean(data, "nospace", &nospc) != 0) {
+ VIR_WARN("neither __com.redhat_reason nor nospace found in disk "
+ "io error event");
+ }
+ reason = nospc ? "enospc" : "";
+ }
if ((actionID = qemuMonitorIOErrorActionTypeFromString(action)) < 0) {
VIR_WARN("unknown disk io error action '%s'", action);
--
2.17.0