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 auto cold migration fallback on
timeout. With this patch set, when we migrate the guest OS, we can
specify a timeout. If the live migration timeouts, the migration will
fallback to cold migration.
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: 1828615.523 ms)
v4:
- move tools/timer.* into src/util/ directory
- use
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 (3):
move daemon/event.* into src/util/ directory
timer impl
force guest to suspend at timeout
cfg.mk | 1 +
daemon/Makefile.am | 1 -
daemon/event.c | 700 ----------------------------------------------
daemon/event.h | 134 ---------
daemon/libvirtd.c | 2 +-
src/Makefile.am | 4 +-
src/libvirt.c | 2 +
src/libvirt_private.syms | 20 ++
src/util/event_impl.c | 700 ++++++++++++++++++++++++++++++++++++++++++++++
src/util/event_impl.h | 134 +++++++++
src/util/timer.c | 159 +++++++++++
src/util/timer.h | 34 +++
tests/Makefile.am | 2 +-
tests/eventtest.c | 2 +-
tools/Makefile.am | 1 -
tools/console.c | 2 +-
tools/virsh.c | 69 +++++-
tools/virsh.pod | 4 +
18 files changed, 1129 insertions(+), 842 deletions(-)
delete mode 100644 daemon/event.c
delete mode 100644 daemon/event.h
create mode 100644 src/util/event_impl.c
create mode 100644 src/util/event_impl.h
create mode 100644 src/util/timer.c
create mode 100644 src/util/timer.h