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