summaryrefslogtreecommitdiff
path: root/migration-tcp.c
AgeCommit message (Collapse)AuthorFilesLines
2012-01-13prepare for future GPLv2+ relicensingPaolo Bonzini1-0/+2
All files under GPLv2 will get GPLv2+ changes starting tomorrow. event_notifier.c and exec-obsolete.h were only ever touched by Red Hat employees and can be relicensed now. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12tcp_close(): check for close() errors too (v2)Eduardo Habkost1-2/+5
In case close() fails, we want to report the error back. Changes v1 -> v2: - Use braces on if statement to match coding style Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-20migration: make migration-{tcp,unix} consistentJuan Quintela1-5/+10
Files are almost identical in functionality, just remove the differences that make no sense. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-20migration: propagate error correctlyJuan Quintela1-9/+11
unix and tcp outgoing migration have error values, but didn't returned it. Make them return the error. Notice that EINPROGRESS & EWOULDBLOCK are not considered errors as call will be retry later. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-20migration: Don't use callback on file defining itJuan Quintela1-2/+2
Signed-off-by: Juan Quintela <quintela@redhat.com>
2011-10-20migration: move migrate_new to do_migrateJuan Quintela1-15/+7
Once there, remove all parameters that don't need to be passed to *start_outgoing_migration() functions Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-20migration: Refactor MigrationState creationJuan Quintela1-14/+1
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-20migration: Rename FdMigrationState MigrationStateJuan Quintela1-6/+6
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-20migration: Fold MigrationState into FdMigrationStateJuan Quintela1-5/+5
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-20migration: Make *start_outgoing_migration return FdMigrationStateJuan Quintela1-2/+2
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-2/+2
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-04-15Remove unused sysemu.h include directivesBlue Swirl1-1/+0
Remove unused sysemu.h include directives to speed up build with the following patches. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-20Fix conversions from pointer to int and vice versaStefan Weil1-2/+2
Here the int values fds[0], sigfd, s, sock and fd are converted to void pointers which are later converted back to an int value. These conversions should always use intptr_t instead of unsigned long. They are needed for environments where sizeof(long) != sizeof(void *). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-25Close socket file descriptor when qemu_accept failsShahar Havivi1-2/+3
Signed-off-by: Shahar Havivi <shaharh@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-22Factorize common migration incoming codeJuan Quintela1-13/+2
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-06-14migration-tcp: call migrate_fd_error() instead of close() and free().Yoshiaki Tamura1-3/+1
This patch fixes the following error report. When changing migration-tcp.c to call migrate_fd_error() instead of close() and free() by itself, monitor is resumed, and returns allocated mig_state is set to current_migration in migration.c allows us to print "info migrate". Reported-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17migration: Clear fd also in error casesJuan Quintela1-3/+2
Not clearing the fd and closing the file makes qemu spin using 100%CPU after incoming migration error. See for instance bug: https://bugzilla.redhat.com/show_bug.cgi?id=518032 Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-07Do not use dprintfmalc1-8/+8
dprintf is already claimed by POSIX[1], and on at least one system is implemented as a macro [1] http://www.opengroup.org/onlinepubs/9699919799/functions/dprintf.html Signed-off-by: malc <av1474@comtv.ru>
2009-12-03Don't leak file descriptorsKevin Wolf1-3/+3
We're leaking file descriptors to child processes. Set FD_CLOEXEC on file descriptors that don't need to be passed to children to stop this misbehaviour. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03live migration: Propagate output monitor to callback handlerJan Kiszka1-4/+6
In order to allow proper progress reporting to the monitor that initiated the migration, forward the monitor reference through the migration layer down to SaveLiveStateHandler. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-17Block live migrationlirans@il.ibm.com1-1/+6
This patch introduces block migration called during live migration. Block are being copied to the destination in an async way. First the code will transfer the whole disk and then transfer all dirty blocks accumulted during the migration. Still need to improve transition from the iterative phase of migration to the end phase. For now transition will take place when all blocks transfered once, all the dirty blocks will be transfered during the end phase (guest is suspended). Changes from v4: - Global variabels moved to a global state structure allocated dynamically. - Minor coding style issues. - Poll block.c for tracking of dirty blocks instead of manage it here. Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-30fix migration to obey -SPaolo Bonzini1-0/+2
Since migration returns right away, starting the VM right after calling qemu_start_incoming_migration is wrong even if -S is not passed. We have to do this after migration has completed. Cc: Glauber Costa <glommer@redhat.com> Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16honor -S on incoming migrationPaolo Bonzini1-3/+0
-S is not honored by qemu on incoming migration. If a domain is migrated while paused, thus, it will start running on the remote machine; this is wrong. Given the trivial patch to fix this, it looks more like a thinko than anything else, probably dating back to the qemu-kvm merge. The interesting part is that the -S mechanism was in fact *used* when migrating (setting autostart = 0) and the incoming migration code was starting the VM at the end of the migration. Since I was removing the vm_start from there, I also corrected a related imprecision. The code was doing a vm_stop "just in case", but we can be sure that the VM is not running---the vm_start call in vl.c has not been reached yet. So the vm_stop is removed together with the vm_start. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-21Cast pointer arguments of get/setsockopt, send to void * to keep GCCmalc1-1/+1
from producing a warning about pointer type mismatches with Winsock Signed-off-by: malc <av1474@comtv.ru>
2009-03-05monitor: Decouple terminals (Jan Kiszka)aliguori1-8/+4
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-2/+2
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
2009-02-05toplevel: remove error handling from qemu_malloc() callers (Avi Kivity)aliguori1-2/+0
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6531 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-12Fix brown-paper-bag bugs from live-migration patch (Charles Duffy)aliguori1-1/+1
In TCP migration, prevent an endless loop trying to retrieve error status. In exec migration, set the close pointer in the FdMigrationState structure. Color me embarrassed. 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@5713 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-11Reintroduce migrate-to-exec: support (Charles Duffy)aliguori1-170/+18
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-11-06Make sure to resume the monitor only after flushing out outstanding aliguori1-8/+6
network traffic. This was bug was reported by Chris Lalancette. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5640 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-25Fix GCC 4 signedness warningblueswir11-1/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5533 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-24Fix whitespace in migration code.aliguori1-20/+20
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-24Fix possibly SEGV in tcp migration error case.aliguori1-1/+1
Spotted by hpoussin. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5526 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-24Live migration for Win32 (Hervé Poussineau)aliguori1-11/+11
This patch fixes migration so that it works on Win32. This requires using socket specific calls since sockets cannot be treated like file descriptors on win32. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5525 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-24Fix windows build after migration changesaliguori1-2/+2
The live migration code broke the windows build. As part of this change, I've switched the BIOS path to C:\Program Files\Qemu instead of /c/Program Files/Qemu. The later is only valid when launching from MSYS but the former is always valid. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5524 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-13Introduce TCP live migration protocolaliguori1-0/+371
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