render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9119d9
From 7d00aff7e3a78d5d03a9191e46975e699cf89e03 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <7d00aff7e3a78d5d03a9191e46975e699cf89e03@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
9119d9
RHEL-only, obsoletes older RHEL-only commit
9119d9
8d2d15ec73393f360a1bf7b88ee2cb491efad037
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
9119d9
index 7dcea2e..cad6be8 100644
9119d9
--- a/src/qemu/qemu_monitor_json.c
9119d9
+++ b/src/qemu/qemu_monitor_json.c
9119d9
@@ -722,7 +722,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
 
9119d9
@@ -739,8 +739,14 @@ qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr data)
9119d9
         VIR_WARN("missing device in disk io error event");
9119d9
     }
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
-- 
9119d9
2.1.3
9119d9