render / rpms / libvirt

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