If the memory of guest OS is changed constantly, the live migration
can not be ended ever for ever.
We can use the command 'virsh migrate-setmaxdowntime' to control the
live migration. But the value of maxdowntime is diffcult to calculate
because it depends on the transfer speed of network and constantly
changing memroy size. We need a easy way to control the live migration.
This patch set add the support of forcing guest to suspend at timeout.
With this patch set, when we migrate the guest OS, we can specify a
timeout. If the live migration timeouts, auto-suspend the guest OS,
where the migration will complete offline.
Test of this patchset on Linux:
Env:
a. The size of guest OS's memory: 1GB
b. The transfer speed of network: about 100Mb/s
c. The size of constantly changing memory: more than 900MB
1. migrate without timeout
# virsh migrate --live RHEL6RC qemu+ssh://<dest IP>/system tcp://<dest
IP>:49152
The migration does not end after 12 hours.
2. migrate with timeout(30 minutes):
# virsh -t migrate --live --timeout 1800 RHEL6RC qemu+ssh://<dest IP>/system
tcp:<dest IP>:49152
(Time: 1816768.066 ms)
v5:
- merge daemon/event.* and src/util/event.*
- test event when builing without libvirtd
v4:
- move tools/timer.* into src/util/ directory
v3:
- use the existing virEventXXXTimeout() APT to implement timer
- merge Add, Update, Delete into one single interface virSetTimeout()
- start timer thread when initializing timer
v2:
- implement timer for Windows
- implement dynamic timers
Wen Congyang (4):
move daemon/event.* into src/util/ directory
test event when builing without libvirtd
timer impl
force guest to suspend at timeout
cfg.mk | 1 +
daemon/Makefile.am | 1 -
daemon/event.c | 700 ----------------------------------------------
daemon/event.h | 134 ---------
src/Makefile.am | 3 +-
src/libvirt.c | 2 +
src/libvirt_private.syms | 17 ++
src/util/event.c | 676 ++++++++++++++++++++++++++++++++++++++++++++-
src/util/event.h | 106 +++++++
src/util/timer.c | 158 +++++++++++
src/util/timer.h | 34 +++
tests/Makefile.am | 6 +-
tests/eventtest.c | 2 +-
tools/Makefile.am | 1 -
tools/console.c | 2 +-
tools/virsh.c | 69 +++++-
tools/virsh.pod | 4 +
17 files changed, 1069 insertions(+), 847 deletions(-)
delete mode 100644 daemon/event.c
delete mode 100644 daemon/event.h
create mode 100644 src/util/timer.c
create mode 100644 src/util/timer.h