]> git.proxmox.com Git - pve-qemu-kvm.git/blame - debian/patches/pve/0042-qmp_snapshot_drive-add-aiocontext.patch
bump version to 2.9.0-1~rc2+5
[pve-qemu-kvm.git] / debian / patches / pve / 0042-qmp_snapshot_drive-add-aiocontext.patch
CommitLineData
87ba737b 1From 4fb6191acb1fdff8170a26ba9acd835c9eaf8218 Mon Sep 17 00:00:00 2001
5191c58a
AD
2From: Alexandre Derumier <aderumier@odiso.com>
3Date: Tue, 13 Sep 2016 01:57:56 +0200
adeb0c7a 4Subject: [PATCH 42/48] qmp_snapshot_drive: add aiocontext
5191c58a
AD
5
6Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
7---
8 savevm-async.c | 15 +++++++++++----
9 1 file changed, 11 insertions(+), 4 deletions(-)
10
11diff --git a/savevm-async.c b/savevm-async.c
1a91ab45 12index 2f4766c..5913a90 100644
5191c58a
AD
13--- a/savevm-async.c
14+++ b/savevm-async.c
9c3bec39 15@@ -345,6 +345,7 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
5191c58a
AD
16 BlockBackend *blk;
17 BlockDriverState *bs;
18 QEMUSnapshotInfo sn1, *sn = &sn1;
19+ AioContext *aio_context;
20 int ret;
21 #ifdef _WIN32
22 struct _timeb tb;
9c3bec39 23@@ -371,20 +372,23 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
5191c58a
AD
24 return;
25 }
26
27+ aio_context = bdrv_get_aio_context(bs);
28+ aio_context_acquire(aio_context);
29+
30 if (bdrv_is_read_only(bs)) {
31 error_setg(errp, "Node '%s' is read only", device);
32- return;
33+ goto out;
34 }
35
36 if (!bdrv_can_snapshot(bs)) {
37 error_setg(errp, QERR_UNSUPPORTED);
38- return;
39+ goto out;
40 }
41
42 if (bdrv_snapshot_find(bs, sn, name) >= 0) {
43 error_set(errp, ERROR_CLASS_GENERIC_ERROR,
44 "snapshot '%s' already exists", name);
45- return;
46+ goto out;
47 }
48
49 sn = &sn1;
9c3bec39 50@@ -409,8 +413,11 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
5191c58a
AD
51 if (ret < 0) {
52 error_set(errp, ERROR_CLASS_GENERIC_ERROR,
53 "Error while creating snapshot on '%s'\n", device);
54- return;
55+ goto out;
56 }
57+
58+out:
59+ aio_context_release(aio_context);
60 }
61
62 void qmp_delete_drive_snapshot(const char *device, const char *name,
63--
642.1.4
65