clean: remove buildinfo/changes
[pve-qemu-kvm.git] / debian / patches / old / live-migration-fixes.diff
bloba7a2729c315cdc51b1d5e945bf4db0b5491e56fc
1 Index: new/arch_init.c
2 ===================================================================
3 --- new.orig/arch_init.c 2012-02-09 13:15:26.000000000 +0100
4 +++ new/arch_init.c 2012-02-09 13:22:53.000000000 +0100
5 @@ -264,6 +264,8 @@
6 uint64_t bytes_transferred_last;
7 double bwidth = 0;
8 uint64_t expected_time = 0;
9 + static int64_t starttime = 0;
10 + double timediff;
11 int ret;
13 if (stage < 0) {
14 @@ -299,10 +301,10 @@
15 qemu_put_buffer(f, (uint8_t *)block->idstr, strlen(block->idstr));
16 qemu_put_be64(f, block->length);
19 + starttime = qemu_get_clock_ns(rt_clock);
22 - bytes_transferred_last = bytes_transferred;
23 - bwidth = qemu_get_clock_ns(rt_clock);
25 while ((ret = qemu_file_rate_limit(f)) == 0) {
26 int bytes_sent;
27 @@ -318,8 +320,8 @@
28 return ret;
31 - bwidth = qemu_get_clock_ns(rt_clock) - bwidth;
32 - bwidth = (bytes_transferred - bytes_transferred_last) / bwidth;
33 + timediff = qemu_get_clock_ns(rt_clock) - starttime;
34 + bwidth = bytes_transferred / timediff;
36 /* if we haven't transferred anything this round, force expected_time to a
37 * a very high value, but without crashing */
38 @@ -340,6 +342,10 @@
40 qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
42 + if ((stage == 2) && (bytes_transferred > 2*ram_bytes_total())) {
43 + return 1;
44 + }
46 expected_time = ram_save_remaining() * TARGET_PAGE_SIZE / bwidth;
48 return (stage == 2) && (expected_time <= migrate_max_downtime());