summaryrefslogtreecommitdiff
path: root/migration.c
AgeCommit message (Collapse)AuthorFilesLines
2009-07-10flush pending aio requestsGlauber Costa1-0/+1
When we finish migration, there may be pending async io requests in flight. If we don't flush it before stage3 starting, it might be the case that the guest loses it. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-09Make sure to only vm_start() a failed migration if we were running to beginAnthony Liguori1-1/+5
with. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16set migration max downtimeGlauber Costa1-0/+19
provide a monitor command to allow one to set the maximum downtime he is willing to suffer during migration, in seconds. "ms", "us", "ns" and "s" are accepted as modifiers. This parameter will be used by ram_save_live() code to determine a safe moment to enter stage 3 Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16add non-arbitrary migration stop conditionGlauber Costa1-0/+11
Currently, we're entering migration's stage 3 when a treshold of 10 pages remain to be transferred in the system. This has hurt some users. However, any proposed threshold is arbitrary by nature, and would only shift the annoyance. The proposal of this patch is to define a max_downtime variable, which represents the maximum downtime a migration user is willing to suffer. Then, based on the bandwidth of last iteration, we calculate how much data we can transfer in such a window of time. Whenever we reach that value (or lower), we know is safe to enter stage3. This has largely improved the situation for me. On localhost migrations, where one would expect things to go as quickly as me running away from the duty of writting software for windows, a kernel compile was enough to get the migration stuck. It takes 20 ~ 30 iterations now. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13migrate_fd_close: delete associated io-handler before closing the fdUri Lublin1-0/+2
It may happen that the io-handler is still registered. That causes select() to return with EBADF, not calling handlers for other fds. The io-handler would be registered when (on the source) the whole state was written but not yet flushed. For example when using QEMUFileBuffered, (tcp-migration) there may be data left in a buffer waiting to be transferred. In such a case buffered_close() calls buffered_flush() which calls migrate_fd_put_buffer, which may, upon EAGAIN, register migrate_fd_put_notify as a handler. Signed-off-by: Uri Lublin <uril@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-22allow changing the speed of a running migrationGlauber Costa1-0/+7
This patch allow us to call migrate_set_speed on running migrations. This should allow mgmt tools to increase the allocated bandwidth of a running migration if there is no progress, and they really want the migration to succeed. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-22augment info migrate with page statusGlauber Costa1-0/+3
This patch augments info migrate output with status about: * ram bytes remaining * ram bytes transferred * ram bytes total This should be enough for management tools to realize whether or not there is progress in migration. We can add more information later on, if the need arrives [v2: fixes bytes_transferred type] Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-20migrate.c: migrate_fd_put_buffer: Do not busyloop: stop writing if EWOULDBLOCKUri Lublin1-1/+1
The migration code is non-blocking, designed for live migration. Practically migrate_fd_put_buffer busy-loops trying to write, as on many machines EWOULDBLOCK==EAGAIN (look in include/asm-generic/errno.h). Signed-off-by: Uri Lublin <uril@redhat.com>
2009-04-05propagate error on failed completion (Glauber Costa)aliguori1-2/+8
migrate_fd_put_ready() calls qemu_savevm_state_complete(), but the later can fail. If it happens, re-start the vm and propagate the error up Based on a patch by Yaniv Kamay Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6997 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-05monitor: Introduce MONITOR_USE_READLINE flag (Jan Kiszka)aliguori1-2/+5
This allows to create monitor terminals that do not make use of the interactive readline back-end but rather send complete commands. The pass-through monitor interface of the gdbstub will be an example. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6717 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-05monitor: Decouple terminals (Jan Kiszka)aliguori1-4/+9
Currently all registered (and activate) monitor terminals work in broadcast mode: Everyone sees what someone else types on some other terminal and what the monitor reports back. This model is broken when you have a management monitor terminal that is automatically operated and some other terminal used for independent guest inspection. Such additional terminals can be multiplexed device channels or a gdb frontend connected to QEMU's stub. Therefore, this patch decouples the buffers and states of all monitor terminals, allowing the user to operate them independently. It finally starts to use the 'mon' parameter that was introduced earlier with the API rework. It also defines the default monitor: the first instantance that has the MONITOR_IS_DEFAULT flag set, and that is the monitor created via the "-monitor" command line switch (or "vc" if none is given). As the patch requires to rework the monitor suspension interface, it also takes the freedom to make it "truely" suspending (so far suspending meant suppressing the prompt, but inputs were still processed). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6715 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-05monitor: Rework API (Jan Kiszka)aliguori1-14/+14
Refactor the monitor API and prepare it for decoupled terminals: term_print functions are renamed to monitor_* and all monitor services gain a new parameter (mon) that will once refer to the monitor instance the output is supposed to appear on. However, the argument remains unused for now. All monitor command callbacks are also extended by a mon parameter so that command handlers are able to pass an appropriate reference to monitor output services. For the case that monitor outputs so far happen without clearly identifiable context, the global variable cur_mon is introduced that shall once provide a pointer either to the current active monitor (while processing commands) or to the default one. On the mid or long term, those use case will be obsoleted so that this variable can be removed again. Due to the broad usage of the monitor interface, this patch mostly deals with converting users of the monitor API. A few of them are already extended to pass 'mon' from the command handler further down to internal functions that invoke monitor_printf. At this chance, monitor-related prototypes are moved from console.h to a new monitor.h. The same is done for the readline API. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6711 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-11Reintroduce migrate-to-exec: support (Charles Duffy)aliguori1-0/+178
KVM's live migration support included support for exec: URLs, allowing system state to be written or received via an arbitrary popen()ed subprocess. This provides a convenient way to pipe state through a compression algorithm or an arbitrary network transport on its way to its destination, and a convenient way to write state to disk; libvirt's qemu driver currently uses migration to exec: targets for this latter purpose. This version of the patch refactors now-common code from migrate-tcp.c into migrate.c. Signed-off-by: Charles Duffy <Charles_Duffy@messageone.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5694 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-24Fix whitespace in migration code.aliguori1-25/+25
Replace tabs with spaces. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5527 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-13Introduce TCP live migration protocolaliguori1-2/+22
This patch introduces a tcp protocol for live migration. It can be used as follows: qemu-system-x86_64 -hda ~/images/linux-test.img -monitor stdio <vm runs for a while> (qemu) migrate tcp:localhost:1025 On the same system: qemu-system-x86_64 -hda ~/images/linux-test.img -incoming tcp:localhost:1025 The monitor can be interacted with while waiting for an incoming live migration. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5478 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-13Introduce UI for live migrationaliguori1-0/+83
This patch introduces a command line parameter and monitor command for starting a live migration. The next patch will provide an example of how to use these parameters. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5476 c046a42c-6fe2-441c-8c8c-71466251a162