]> git.proxmox.com Git - pve-qemu-kvm.git/blob - debian/patches/pve/0028-savevm-async-migration-and-bdrv_open-update.patch
fix backup jobs for multiple disks
[pve-qemu-kvm.git] / debian / patches / pve / 0028-savevm-async-migration-and-bdrv_open-update.patch
1 From 54847dbb3050d9ec9dd786d572d9c1dff0757d4d Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Thu, 10 Dec 2015 15:14:00 +0100
4 Subject: [PATCH 28/47] savevm-async: migration and bdrv_open update
5
6 ---
7 savevm-async.c | 25 ++++++++++++-------------
8 1 file changed, 12 insertions(+), 13 deletions(-)
9
10 diff --git a/savevm-async.c b/savevm-async.c
11 index 9704a41..6ac03af 100644
12 --- a/savevm-async.c
13 +++ b/savevm-async.c
14 @@ -154,10 +154,10 @@ static int block_state_close(void *opaque)
15 return bdrv_flush(snap_state.bs);
16 }
17
18 -static int block_state_put_buffer(void *opaque, const uint8_t *buf,
19 - int64_t pos, int size)
20 +static ssize_t block_state_put_buffer(void *opaque, const uint8_t *buf,
21 + int64_t pos, size_t size)
22 {
23 - int ret;
24 + ssize_t ret;
25
26 assert(pos == snap_state.bs_pos);
27
28 @@ -201,12 +201,13 @@ static void process_savevm_co(void *opaque)
29 }
30
31 while (snap_state.state == SAVE_STATE_ACTIVE) {
32 - uint64_t pending_size;
33 + uint64_t pending_size, pend_post, pend_nonpost;
34
35 - pending_size = qemu_savevm_state_pending(snap_state.file, 0);
36 + qemu_savevm_state_pending(snap_state.file, 0, &pend_nonpost, &pend_post);
37 + pending_size = pend_post + pend_nonpost;
38
39 if (pending_size) {
40 - ret = qemu_savevm_state_iterate(snap_state.file);
41 + ret = qemu_savevm_state_iterate(snap_state.file, false);
42 if (ret < 0) {
43 save_snapshot_error("qemu_savevm_state_iterate error %d", ret);
44 break;
45 @@ -217,7 +218,7 @@ static void process_savevm_co(void *opaque)
46 if (store_and_stop())
47 break;
48 DPRINTF("savevm inerate finished\n");
49 - qemu_savevm_state_complete_precopy(snap_state.file);
50 + qemu_savevm_state_complete_precopy(snap_state.file, false);
51 DPRINTF("save complete\n");
52 save_snapshot_completed();
53 break;
54 @@ -250,7 +251,6 @@ static const QEMUFileOps block_file_ops = {
55
56 void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
57 {
58 - BlockDriver *drv = NULL;
59 Error *local_err = NULL;
60
61 int bdrv_oflags = BDRV_O_RDWR | BDRV_O_RESIZE;
62 @@ -289,7 +289,7 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
63 QDict *options = NULL;
64 options = qdict_new();
65 qdict_put(options, "driver", qstring_from_str("raw"));
66 - ret = bdrv_open(&snap_state.bs, statefile, NULL, options, bdrv_oflags, drv, &local_err);
67 + ret = bdrv_open(&snap_state.bs, statefile, NULL, options, bdrv_oflags, &local_err);
68 if (ret < 0) {
69 error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
70 goto restart;
71 @@ -454,8 +454,8 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
72 }
73 }
74
75 -static int loadstate_get_buffer(void *opaque, uint8_t *buf, int64_t pos,
76 - int size)
77 +static ssize_t loadstate_get_buffer(void *opaque, uint8_t *buf, int64_t pos,
78 + size_t size)
79 {
80 BlockDriverState *bs = (BlockDriverState *)opaque;
81 int64_t maxlen = bdrv_getlength(bs);
82 @@ -478,7 +478,6 @@ static const QEMUFileOps loadstate_file_ops = {
83 int load_state_from_blockdev(const char *filename)
84 {
85 BlockDriverState *bs = NULL;
86 - BlockDriver *drv = NULL;
87 Error *local_err = NULL;
88 Error *blocker = NULL;
89
90 @@ -486,7 +485,7 @@ int load_state_from_blockdev(const char *filename)
91 int ret;
92
93 bs = bdrv_new();
94 - ret = bdrv_open(&bs, filename, NULL, NULL, 0, drv, &local_err);
95 + ret = bdrv_open(&bs, filename, NULL, NULL, 0, &local_err);
96 error_setg(&blocker, "block device is in use by load state");
97 bdrv_op_block_all(bs, blocker);
98
99 --
100 2.1.4
101