aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-06-24 13:06:13 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-06-24 13:06:13 +0100
commit089a39486f2c47994c6c0d34ac7abf34baf40d9d (patch)
tree07bf9220989162df8d29b99568d13ce6d5261822 /block
parent27acb9dd2407f41550e453b85aa5ebf1bd618b79 (diff)
parentd622cb5879ca8006d5482158e4e3b272a068c301 (diff)
downloadqemu-089a39486f2c47994c6c0d34ac7abf34baf40d9d.zip
qemu-089a39486f2c47994c6c0d34ac7abf34baf40d9d.tar.gz
qemu-089a39486f2c47994c6c0d34ac7abf34baf40d9d.tar.bz2
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
* remotes/qmp-unstable/queue/qmp: (43 commits) monitor: protect event emission monitor: protect outbuf and mux_out with mutex qemu-char: make writes thread-safe qemu-char: move pty_chr_update_read_handler around qemu-char: do not call chr_write directly qemu-char: introduce qemu_chr_alloc qapi event: clean up qapi event: convert QUORUM events qapi event: convert GUEST_PANICKED qapi event: convert BALLOON_CHANGE qmp: convert ACPI_DEVICE_OST event qapi event: convert SPICE events qapi event: convert VNC events qapi event: convert NIC_RX_FILTER_CHANGED qapi event: convert other BLOCK_JOB events qapi event: convert BLOCK_IMAGE_CORRUPTED qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR qapi event: convert DEVICE_TRAY_MOVED qapi event: convert DEVICE_DELETED qapi event: convert WATCHDOG ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block')
-rw-r--r--block/backup.c2
-rw-r--r--block/mirror.c9
-rw-r--r--block/qcow2-refcount.c14
-rw-r--r--block/quorum.c25
-rw-r--r--block/stream.c4
5 files changed, 24 insertions, 30 deletions
diff --git a/block/backup.c b/block/backup.c
index 15a2e55..7978ae2 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -325,7 +325,7 @@ static void coroutine_fn backup_run(void *opaque)
/* Depending on error action, fail now or retry cluster */
BlockErrorAction action =
backup_error_action(job, error_is_read, -ret);
- if (action == BDRV_ACTION_REPORT) {
+ if (action == BLOCK_ERROR_ACTION_REPORT) {
break;
} else {
start--;
diff --git a/block/mirror.c b/block/mirror.c
index 94c8661..301a04d 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -118,7 +118,7 @@ static void mirror_write_complete(void *opaque, int ret)
bdrv_set_dirty(source, op->sector_num, op->nb_sectors);
action = mirror_error_action(s, false, -ret);
- if (action == BDRV_ACTION_REPORT && s->ret >= 0) {
+ if (action == BLOCK_ERROR_ACTION_REPORT && s->ret >= 0) {
s->ret = ret;
}
}
@@ -135,7 +135,7 @@ static void mirror_read_complete(void *opaque, int ret)
bdrv_set_dirty(source, op->sector_num, op->nb_sectors);
action = mirror_error_action(s, true, -ret);
- if (action == BDRV_ACTION_REPORT && s->ret >= 0) {
+ if (action == BLOCK_ERROR_ACTION_REPORT && s->ret >= 0) {
s->ret = ret;
}
@@ -415,7 +415,8 @@ static void coroutine_fn mirror_run(void *opaque)
trace_mirror_before_flush(s);
ret = bdrv_flush(s->target);
if (ret < 0) {
- if (mirror_error_action(s, false, -ret) == BDRV_ACTION_REPORT) {
+ if (mirror_error_action(s, false, -ret) ==
+ BLOCK_ERROR_ACTION_REPORT) {
goto immediate_exit;
}
} else {
@@ -426,7 +427,7 @@ static void coroutine_fn mirror_run(void *opaque)
*/
s->common.offset = end * BDRV_SECTOR_SIZE;
if (!s->synced) {
- block_job_ready(&s->common);
+ block_job_event_ready(&s->common);
s->synced = true;
}
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/block/quorum.c b/block/quorum.c
index 426077a..86802d3 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -17,6 +17,7 @@
#include <gnutls/crypto.h>
#include "block/block_int.h"
#include "qapi/qmp/qjson.h"
+#include "qapi-event.h"
#define HASH_LENGTH 32
@@ -198,32 +199,22 @@ static QuorumAIOCB *quorum_aio_get(BDRVQuorumState *s,
static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret)
{
- QObject *data;
- assert(node_name);
- data = qobject_from_jsonf("{ 'node-name': %s"
- ", 'sector-num': %" PRId64
- ", 'sectors-count': %d }",
- node_name, acb->sector_num, acb->nb_sectors);
+ const char *msg = NULL;
if (ret < 0) {
- QDict *dict = qobject_to_qdict(data);
- qdict_put(dict, "error", qstring_from_str(strerror(-ret)));
+ msg = strerror(-ret);
}
- monitor_protocol_event(QEVENT_QUORUM_REPORT_BAD, data);
- qobject_decref(data);
+ qapi_event_send_quorum_report_bad(!!msg, msg, node_name,
+ acb->sector_num, acb->nb_sectors, &error_abort);
}
static void quorum_report_failure(QuorumAIOCB *acb)
{
- QObject *data;
const char *reference = acb->common.bs->device_name[0] ?
acb->common.bs->device_name :
acb->common.bs->node_name;
- data = qobject_from_jsonf("{ 'reference': %s"
- ", 'sector-num': %" PRId64
- ", 'sectors-count': %d }",
- reference, acb->sector_num, acb->nb_sectors);
- monitor_protocol_event(QEVENT_QUORUM_FAILURE, data);
- qobject_decref(data);
+
+ qapi_event_send_quorum_failure(reference, acb->sector_num,
+ acb->nb_sectors, &error_abort);
}
static int quorum_vote_error(QuorumAIOCB *acb);
diff --git a/block/stream.c b/block/stream.c
index 91d18a2..0433409 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -159,14 +159,14 @@ wait:
BlockErrorAction action =
block_job_error_action(&s->common, s->common.bs, s->on_error,
true, -ret);
- if (action == BDRV_ACTION_STOP) {
+ if (action == BLOCK_ERROR_ACTION_STOP) {
n = 0;
continue;
}
if (error == 0) {
error = ret;
}
- if (action == BDRV_ACTION_REPORT) {
+ if (action == BLOCK_ERROR_ACTION_REPORT) {
break;
}
}