1 From b4f04c214d85b8570af61012a9f81ce037ccd81f Mon Sep 17 00:00:00 2001
2 From: Alexandre Derumier <aderumier@odiso.com>
3 Date: Mon, 7 Nov 2016 11:47:50 +0100
4 Subject: [PATCH] qmp_delete_drive_snapshot : add aiocontext
6 this fix snapshot delete of qcow2 with iothread enabled
8 Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
10 savevm-async.c | 13 ++++++++++---
11 1 file changed, 10 insertions(+), 3 deletions(-)
13 diff --git a/savevm-async.c b/savevm-async.c
14 index 2faaf7a..05b5b19 100644
17 @@ -427,6 +427,7 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
19 QEMUSnapshotInfo sn1, *sn = &sn1;
20 Error *local_err = NULL;
21 + AioContext *aio_context;
25 @@ -443,22 +444,28 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
29 + aio_context = bdrv_get_aio_context(bs);
30 + aio_context_acquire(aio_context);
32 if (!bdrv_can_snapshot(bs)) {
33 error_setg(errp, QERR_UNSUPPORTED);
38 if (bdrv_snapshot_find(bs, sn, name) < 0) {
39 /* return success if snapshot does not exists */
44 ret = bdrv_snapshot_delete(bs, NULL, name, &local_err);
46 error_set(errp, ERROR_CLASS_GENERIC_ERROR,
47 "Error while deleting snapshot on '%s'\n", device);
53 + aio_context_release(aio_context);
56 static ssize_t loadstate_get_buffer(void *opaque, uint8_t *buf, int64_t pos,