pve-qemu/debian/patches/pve/0028-savevm-async-migration...

102 lines
3.8 KiB
Diff

From 54847dbb3050d9ec9dd786d572d9c1dff0757d4d Mon Sep 17 00:00:00 2001
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
Date: Thu, 10 Dec 2015 15:14:00 +0100
Subject: [PATCH 28/48] savevm-async: migration and bdrv_open update
---
savevm-async.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/savevm-async.c b/savevm-async.c
index 9704a41..6ac03af 100644
--- a/savevm-async.c
+++ b/savevm-async.c
@@ -154,10 +154,10 @@ static int block_state_close(void *opaque)
return bdrv_flush(snap_state.bs);
}
-static int block_state_put_buffer(void *opaque, const uint8_t *buf,
- int64_t pos, int size)
+static ssize_t block_state_put_buffer(void *opaque, const uint8_t *buf,
+ int64_t pos, size_t size)
{
- int ret;
+ ssize_t ret;
assert(pos == snap_state.bs_pos);
@@ -201,12 +201,13 @@ static void process_savevm_co(void *opaque)
}
while (snap_state.state == SAVE_STATE_ACTIVE) {
- uint64_t pending_size;
+ uint64_t pending_size, pend_post, pend_nonpost;
- pending_size = qemu_savevm_state_pending(snap_state.file, 0);
+ qemu_savevm_state_pending(snap_state.file, 0, &pend_nonpost, &pend_post);
+ pending_size = pend_post + pend_nonpost;
if (pending_size) {
- ret = qemu_savevm_state_iterate(snap_state.file);
+ ret = qemu_savevm_state_iterate(snap_state.file, false);
if (ret < 0) {
save_snapshot_error("qemu_savevm_state_iterate error %d", ret);
break;
@@ -217,7 +218,7 @@ static void process_savevm_co(void *opaque)
if (store_and_stop())
break;
DPRINTF("savevm inerate finished\n");
- qemu_savevm_state_complete_precopy(snap_state.file);
+ qemu_savevm_state_complete_precopy(snap_state.file, false);
DPRINTF("save complete\n");
save_snapshot_completed();
break;
@@ -250,7 +251,6 @@ static const QEMUFileOps block_file_ops = {
void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
{
- BlockDriver *drv = NULL;
Error *local_err = NULL;
int bdrv_oflags = BDRV_O_RDWR | BDRV_O_RESIZE;
@@ -289,7 +289,7 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
QDict *options = NULL;
options = qdict_new();
qdict_put(options, "driver", qstring_from_str("raw"));
- ret = bdrv_open(&snap_state.bs, statefile, NULL, options, bdrv_oflags, drv, &local_err);
+ ret = bdrv_open(&snap_state.bs, statefile, NULL, options, bdrv_oflags, &local_err);
if (ret < 0) {
error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
goto restart;
@@ -454,8 +454,8 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
}
}
-static int loadstate_get_buffer(void *opaque, uint8_t *buf, int64_t pos,
- int size)
+static ssize_t loadstate_get_buffer(void *opaque, uint8_t *buf, int64_t pos,
+ size_t size)
{
BlockDriverState *bs = (BlockDriverState *)opaque;
int64_t maxlen = bdrv_getlength(bs);
@@ -478,7 +478,6 @@ static const QEMUFileOps loadstate_file_ops = {
int load_state_from_blockdev(const char *filename)
{
BlockDriverState *bs = NULL;
- BlockDriver *drv = NULL;
Error *local_err = NULL;
Error *blocker = NULL;
@@ -486,7 +485,7 @@ int load_state_from_blockdev(const char *filename)
int ret;
bs = bdrv_new();
- ret = bdrv_open(&bs, filename, NULL, NULL, 0, drv, &local_err);
+ ret = bdrv_open(&bs, filename, NULL, NULL, 0, &local_err);
error_setg(&blocker, "block device is in use by load state");
bdrv_op_block_all(bs, blocker);
--
2.1.4