render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
404507
From 039a4ec94aca6cb2226161de49e4b8a7c53f8321 Mon Sep 17 00:00:00 2001
404507
Message-Id: <039a4ec94aca6cb2226161de49e4b8a7c53f8321@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
404507
index e0f942788d..a1fa37e1e9 100644
9119d9
--- a/src/qemu/qemu_monitor_json.c
9119d9
+++ b/src/qemu/qemu_monitor_json.c
404507
@@ -641,7 +641,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
 
404507
@@ -657,8 +657,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
-- 
404507
2.14.3
9119d9