[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 26/40] qapi event: convert BLOCK_IMAGE_CORRUPTED
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PULL 26/40] qapi event: convert BLOCK_IMAGE_CORRUPTED |
Date: |
Thu, 19 Jun 2014 15:39:38 -0400 |
From: Wenchao Xia <address@hidden>
Signed-off-by: Wenchao Xia <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
block/qcow2-refcount.c | 14 ++++++++------
docs/qmp/qmp-events.txt | 22 ----------------------
qapi/block-core.json | 24 ++++++++++++++++++++++++
3 files changed, 32 insertions(+), 28 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 9507aef..cc6cf74 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -27,6 +27,7 @@
#include "block/qcow2.h"
#include "qemu/range.h"
#include "qapi/qmp/types.h"
+#include "qapi-event.h"
static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size);
static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
@@ -1807,7 +1808,6 @@ int qcow2_pre_write_overlap_check(BlockDriverState *bs,
int ign, int64_t offset,
} else if (ret > 0) {
int metadata_ol_bitnr = ffs(ret) - 1;
char *message;
- QObject *data;
assert(metadata_ol_bitnr < QCOW2_OL_MAX_BITNR);
@@ -1816,12 +1816,14 @@ int qcow2_pre_write_overlap_check(BlockDriverState *bs,
int ign, int64_t offset,
metadata_ol_names[metadata_ol_bitnr]);
message = g_strdup_printf("Prevented %s overwrite",
metadata_ol_names[metadata_ol_bitnr]);
- data = qobject_from_jsonf("{ 'device': %s, 'msg': %s, 'offset': %"
- PRId64 ", 'size': %" PRId64 " }", bs->device_name, message,
- offset, size);
- monitor_protocol_event(QEVENT_BLOCK_IMAGE_CORRUPTED, data);
+ qapi_event_send_block_image_corrupted(bdrv_get_device_name(bs),
+ message,
+ true,
+ offset,
+ true,
+ size,
+ &error_abort);
g_free(message);
- qobject_decref(data);
qcow2_mark_corrupt(bs);
bs->drv = NULL; /* make BDS unusable */
diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt
index f67a9ec..eec3955 100644
--- a/docs/qmp/qmp-events.txt
+++ b/docs/qmp/qmp-events.txt
@@ -18,28 +18,6 @@ Example:
"data": { "actual": 944766976 },
"timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
-BLOCK_IMAGE_CORRUPTED
----------------------
-
-Emitted when a disk image is being marked corrupt.
-
-Data:
-
-- "device": Device name (json-string)
-- "msg": Informative message (e.g., reason for the corruption) (json-string)
-- "offset": If the corruption resulted from an image access, this is the access
- offset into the image (json-int)
-- "size": If the corruption resulted from an image access, this is the access
- size (json-int)
-
-Example:
-
-{ "event": "BLOCK_IMAGE_CORRUPTED",
- "data": { "device": "ide0-hd0",
- "msg": "Prevented active L1 table overwrite", "offset": 196608,
- "size": 65536 },
- "timestamp": { "seconds": 1378126126, "microseconds": 966463 } }
-
BLOCK_JOB_CANCELLED
-------------------
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 682864d..2dbac42 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1429,6 +1429,30 @@
##
+# @BLOCK_IMAGE_CORRUPTED
+#
+# Emitted when a disk image is being marked corrupt
+#
+# @device: device name
+#
+# @msg: informative message for human consumption, such as the kind of
+# corruption being detected
+#
+# @offset: #optional, if the corruption resulted from an image access, this is
+# the access offset into the image
+#
+# @size: #optional, if the corruption resulted from an image access, this is
+# the access size
+#
+# Since: 1.7
+##
+{ 'event': 'BLOCK_IMAGE_CORRUPTED',
+ 'data': { 'device' : 'str',
+ 'msg' : 'str',
+ '*offset': 'int',
+ '*size' : 'int' } }
+
+##
# @BLOCK_IO_ERROR
#
# Emitted when a disk I/O error occurs
--
1.9.3
- [Qemu-devel] [PULL 13/40] qapi event: convert SHUTDOWN, (continued)
- [Qemu-devel] [PULL 13/40] qapi event: convert SHUTDOWN, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 19/40] qapi event: convert SUSPEND_DISK, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 20/40] qapi event: convert WAKEUP, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 18/40] qapi event: convert SUSPEND, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 21/40] qapi event: convert RTC_CHANGE, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 16/40] qapi event: convert STOP, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 23/40] qapi event: convert DEVICE_DELETED, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 22/40] qapi event: convert WATCHDOG, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 24/40] qapi event: convert DEVICE_TRAY_MOVED, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 25/40] qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 26/40] qapi event: convert BLOCK_IMAGE_CORRUPTED,
Luiz Capitulino <=
- [Qemu-devel] [PULL 27/40] qapi event: convert other BLOCK_JOB events, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 30/40] qapi event: convert SPICE events, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 34/40] qapi event: clean up, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 28/40] qapi event: convert NIC_RX_FILTER_CHANGED, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 35/40] qemu-char: introduce qemu_chr_alloc, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 29/40] qapi event: convert VNC events, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 32/40] qapi event: convert GUEST_PANICKED, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 31/40] qapi event: convert BALLOON_CHANGE, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 37/40] qemu-char: move pty_chr_update_read_handler around, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 33/40] qapi event: convert QUORUM events, Luiz Capitulino, 2014/06/19