2018-02-19 12:38:54 +03:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-04-05 11:49:19 +03:00
|
|
|
From: Alexandre Derumier <aderumier@odiso.com>
|
|
|
|
Date: Tue, 13 Sep 2016 01:57:56 +0200
|
2018-08-30 16:00:07 +03:00
|
|
|
Subject: [PATCH] PVE: block: snapshot: qmp_snapshot_drive: add aiocontext
|
2017-04-05 11:49:19 +03:00
|
|
|
|
|
|
|
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
|
|
|
|
---
|
|
|
|
savevm-async.c | 15 +++++++++++----
|
|
|
|
1 file changed, 11 insertions(+), 4 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/savevm-async.c b/savevm-async.c
|
2018-08-30 16:00:07 +03:00
|
|
|
index 157eb7a50d..87d5460a26 100644
|
2017-04-05 11:49:19 +03:00
|
|
|
--- a/savevm-async.c
|
|
|
|
+++ b/savevm-async.c
|
2018-08-30 16:00:07 +03:00
|
|
|
@@ -379,6 +379,7 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
|
2017-04-05 11:49:19 +03:00
|
|
|
BlockBackend *blk;
|
|
|
|
BlockDriverState *bs;
|
|
|
|
QEMUSnapshotInfo sn1, *sn = &sn1;
|
|
|
|
+ AioContext *aio_context;
|
|
|
|
int ret;
|
|
|
|
#ifdef _WIN32
|
|
|
|
struct _timeb tb;
|
2018-08-30 16:00:07 +03:00
|
|
|
@@ -405,20 +406,23 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
|
2017-04-05 11:49:19 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ aio_context = bdrv_get_aio_context(bs);
|
|
|
|
+ aio_context_acquire(aio_context);
|
|
|
|
+
|
|
|
|
if (bdrv_is_read_only(bs)) {
|
|
|
|
error_setg(errp, "Node '%s' is read only", device);
|
|
|
|
- return;
|
|
|
|
+ goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bdrv_can_snapshot(bs)) {
|
|
|
|
error_setg(errp, QERR_UNSUPPORTED);
|
|
|
|
- return;
|
|
|
|
+ goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bdrv_snapshot_find(bs, sn, name) >= 0) {
|
|
|
|
error_set(errp, ERROR_CLASS_GENERIC_ERROR,
|
|
|
|
"snapshot '%s' already exists", name);
|
|
|
|
- return;
|
|
|
|
+ goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
sn = &sn1;
|
2018-08-30 16:00:07 +03:00
|
|
|
@@ -443,8 +447,11 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
|
2017-04-05 11:49:19 +03:00
|
|
|
if (ret < 0) {
|
|
|
|
error_set(errp, ERROR_CLASS_GENERIC_ERROR,
|
|
|
|
"Error while creating snapshot on '%s'\n", device);
|
|
|
|
- return;
|
|
|
|
+ goto out;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+out:
|
|
|
|
+ aio_context_release(aio_context);
|
|
|
|
}
|
|
|
|
|
|
|
|
void qmp_delete_drive_snapshot(const char *device, const char *name,
|
|
|
|
--
|
2017-04-05 12:51:17 +03:00
|
|
|
2.11.0
|
2017-04-05 11:49:19 +03:00
|
|
|
|