thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
05bba0
From c13c12dd0abcb0e9800fa3a4769460067c0a5401 Mon Sep 17 00:00:00 2001
05bba0
From: Max Reitz <mreitz@redhat.com>
05bba0
Date: Sat, 13 Jun 2015 16:22:01 +0200
05bba0
Subject: [PATCH 07/42] qapi/block: Add "fatal" to BLOCK_IMAGE_CORRUPTED
05bba0
05bba0
Message-id: <1434212556-3927-8-git-send-email-mreitz@redhat.com>
05bba0
Patchwork-id: 66026
05bba0
O-Subject: [RHEL-7.2 qemu-kvm PATCH 07/42] qapi/block: Add "fatal" to BLOCK_IMAGE_CORRUPTED
05bba0
Bugzilla: 1129893
05bba0
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
05bba0
RH-Acked-by: Fam Zheng <famz@redhat.com>
05bba0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
05bba0
05bba0
BZ: 1129893
05bba0
05bba0
Not every BLOCK_IMAGE_CORRUPTED event must be fatal; for example, when
05bba0
reading from an image, they should generally not be. Nonetheless, even
05bba0
an image only read from may of course be corrupted and this can be
05bba0
detected during normal operation. In this case, a non-fatal event should
05bba0
be emitted, but the image should not be marked corrupt (in accordance to
05bba0
"fatal" set to false).
05bba0
05bba0
Signed-off-by: Max Reitz <mreitz@redhat.com>
05bba0
Reviewed-by: Eric Blake <eblake@redhat.com>
05bba0
Message-id: 1409926039-29044-2-git-send-email-mreitz@redhat.com
05bba0
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
05bba0
(cherry picked from commit 9bf040b962f90aa2e1cef6543dfee6c96f73ef7e)
05bba0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
05bba0
05bba0
Conflicts:
05bba0
	block/qcow2-refcount.c
05bba0
	qapi/block-core.json
05bba0
	QMP/qmp-events.txt
05bba0
05bba0
Upstream, there is a more sophisticated QMP event support than just a
05bba0
list of events in a text file.
05bba0
05bba0
Signed-off-by: Max Reitz <mreitz@redhat.com>
05bba0
---
05bba0
 QMP/qmp-events.txt     | 5 ++++-
05bba0
 block/qcow2-refcount.c | 4 ++--
05bba0
 2 files changed, 6 insertions(+), 3 deletions(-)
05bba0
05bba0
diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
05bba0
index 7d16a6d..39daed4 100644
05bba0
--- a/QMP/qmp-events.txt
05bba0
+++ b/QMP/qmp-events.txt
05bba0
@@ -31,13 +31,16 @@ Data:
05bba0
             offset into the image (json-int)
05bba0
 - "size":   If the corruption resulted from an image access, this is the access
05bba0
             size (json-int)
05bba0
+- "fatal":  If set, the image is marked corrupt and therefore unusable after
05bba0
+            this event and must be repaired (Since 2.2; before, every
05bba0
+            BLOCK_IMAGE_CORRUPTED event was fatal)
05bba0
 
05bba0
 Example:
05bba0
 
05bba0
 { "event": "BLOCK_IMAGE_CORRUPTED",
05bba0
     "data": { "device": "ide0-hd0",
05bba0
         "msg": "Prevented active L1 table overwrite", "offset": 196608,
05bba0
-        "size": 65536 },
05bba0
+        "size": 65536, "fatal": true },
05bba0
     "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
05bba0
 
05bba0
 BLOCK_IO_ERROR
05bba0
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
05bba0
index 4f86923..6fa6daf 100644
05bba0
--- a/block/qcow2-refcount.c
05bba0
+++ b/block/qcow2-refcount.c
05bba0
@@ -1806,8 +1806,8 @@ int qcow2_pre_write_overlap_check(BlockDriverState *bs, int ign, int64_t offset,
05bba0
         message = g_strdup_printf("Prevented %s overwrite",
05bba0
                 metadata_ol_names[metadata_ol_bitnr]);
05bba0
         data = qobject_from_jsonf("{ 'device': %s, 'msg': %s, 'offset': %"
05bba0
-                PRId64 ", 'size': %" PRId64 " }", bs->device_name, message,
05bba0
-                offset, size);
05bba0
+                PRId64 ", 'size': %" PRId64 ", 'fatal': true }",
05bba0
+                bs->device_name, message, offset, size);
05bba0
         monitor_protocol_event(QEVENT_BLOCK_IMAGE_CORRUPTED, data);
05bba0
         g_free(message);
05bba0
         qobject_decref(data);
05bba0
-- 
05bba0
1.8.3.1
05bba0