1 From 325948ca53c1fd96094f24b49e5ae415454f8947 Mon Sep 17 00:00:00 2001
2 From: Alexandre Derumier <aderumier@odiso.com>
3 Date: Tue, 13 Sep 2016 01:57:56 +0200
4 Subject: [PATCH 42/47] qmp_snapshot_drive: add aiocontext
6 Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
8 savevm-async.c | 15 +++++++++++----
9 1 file changed, 11 insertions(+), 4 deletions(-)
11 diff --git a/savevm-async.c b/savevm-async.c
12 index 2f4766c..5913a90 100644
15 @@ -345,6 +345,7 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
18 QEMUSnapshotInfo sn1, *sn = &sn1;
19 + AioContext *aio_context;
23 @@ -371,20 +372,23 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
27 + aio_context = bdrv_get_aio_context(bs);
28 + aio_context_acquire(aio_context);
30 if (bdrv_is_read_only(bs)) {
31 error_setg(errp, "Node '%s' is read only", device);
36 if (!bdrv_can_snapshot(bs)) {
37 error_setg(errp, QERR_UNSUPPORTED);
42 if (bdrv_snapshot_find(bs, sn, name) >= 0) {
43 error_set(errp, ERROR_CLASS_GENERIC_ERROR,
44 "snapshot '%s' already exists", name);
50 @@ -409,8 +413,11 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
52 error_set(errp, ERROR_CLASS_GENERIC_ERROR,
53 "Error while creating snapshot on '%s'\n", device);
59 + aio_context_release(aio_context);
62 void qmp_delete_drive_snapshot(const char *device, const char *name,