summaryrefslogtreecommitdiffstats
path: root/migration.h
Commit message (Collapse)AuthorAgeFilesLines
* qapi: Convert migrateLuiz Capitulino2012-03-151-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | The migrate command is one of those commands where HMP and QMP completely mix up together. This made the conversion to the QAPI (which separates the command into QMP and HMP parts) a bit difficult. The first important change to be noticed is that this commit completes the removal of the Monitor object from migration code, started by the previous commit. Another important and tricky change is about supporting the non-detached mode. That is, if the user doesn't pass '-d' the migrate command will lock the monitor and will only release it when migration is finished. To support this in the new HMP command (hmp_migrate()), it is necessary to create a timer which runs every second and checks if the migration is still active. If it is, the timer callback will re-schedule itself to run one second in the future. If the migration has already finished, the monitor lock is released and the user can use it normally. All these changes should be transparent to the user. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Purge migration of (almost) everything to do with monitorsLuiz Capitulino2012-03-151-1/+1
| | | | | | | | | | | | | | | | | The Monitor object is passed back and forth within the migration/savevm code so that it can print errors and progress to the user. However, that approach assumes a HMP monitor, being completely invalid in QMP. This commit drops almost every single usage of the Monitor object, all monitor_printf() calls have been converted into DPRINTF() ones. There are a few remaining Monitor objects, those are going to be dropped by the next commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Merge remote-tracking branch 'stefanha/trivial-patches-next' into stagingAnthony Liguori2011-12-141-2/+0
|\
| * migration.h: remove incoming_expected declarationsIsaku Yamahata2011-12-141-2/+0
| | | | | | | | | | | | | | | | | | The variable is deleted by 1bcef683bf840a928d633755031ac572d5fdb851 So remove its declaration. Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* | qapi: Convert migrate_set_speedLuiz Capitulino2011-12-061-2/+0
| | | | | | | | Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* | qapi: Convert migrate_set_downtimeLuiz Capitulino2011-12-061-3/+0
| | | | | | | | Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* | qapi: Convert migrate_cancelLuiz Capitulino2011-12-061-2/+0
|/ | | | Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* migrate: add migration blockersAnthony Liguori2011-11-211-0/+15
| | | | | | | | | | | | | This lets different subsystems register an Error that is thrown whenever migration is attempted. This works nicely because it gracefully supports things like hotplug. Right now, if multiple errors are registered, only one of them is reported. I expect that for 1.1, we'll extend query-migrate to return all of the reasons why migration is disabled at any given point in time. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: add status query functionsGerd Hoffmann2011-10-251-0/+2
| | | | | | | Add migration_is_active and migration_has_failed functions to query migration state. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* migration: Make state definitions localJuan Quintela2011-10-201-8/+0
| | | | Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Export a function that tells if the migration has finished correctlyJuan Quintela2011-10-201-1/+1
| | | | | | This will allow us to hide the state values. Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Remove migration cancel() callbackJuan Quintela2011-10-201-1/+0
| | | | | | It is used only in one place Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Remove get_status() accessorJuan Quintela2011-10-201-1/+0
| | | | | | | It is only used inside migration.c, and fields on that struct are accessed all around the place on that file. Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Our release callback was just freeJuan Quintela2011-10-201-1/+0
| | | | | | | | | | | | We called it from a single place, and always with state != MIG_STATE_ACTIVE. Just remove the whole callback. For users of the notifier, notice that this is exactly the case where they don't care, we are just freeing the state from previous failed migration (it can't be a sucessful one, otherwise we would not be running on that machine in the first place). Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: Introduce MIG_STATE_SETUPJuan Quintela2011-10-201-4/+7
| | | | | | | | Use MIG_STATE_ACTIVE only when migration has really started. Use this new state to setup migration parameters. Change defines for an anonymous struct. Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: move migrate_new to do_migrateJuan Quintela2011-10-201-27/+4
| | | | | | | | 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>
* migration: Make all posible migration functions staticJuan Quintela2011-10-201-12/+0
| | | | | | | I have to move two functions postions to avoid forward declarations Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: Refactor MigrationState creationJuan Quintela2011-10-201-8/+3
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: Rename FdMigrationState MigrationStateJuan Quintela2011-10-201-19/+19
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: Fold MigrationState into FdMigrationStateJuan Quintela2011-10-201-18/+5
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: Use FdMigrationState instead of MigrationState when possibleJuan Quintela2011-10-201-8/+8
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: Make *start_outgoing_migration return FdMigrationStateJuan Quintela2011-10-201-4/+4
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: move some declarations to migration.hBlue Swirl2011-04-151-0/+9
| | | | | | Move a few migration related declarations to migration.h. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* add migration state change notifiersGerd Hoffmann2011-01-241-0/+5
| | | | | | | | | | This patch adds functions to register and unregister notifiers for migration state changes and a function to query the migration state. The notifier is called on every state change. Once after establishing a new migration object (which is in active state then) and once when the state changes from active to completed, canceled or error. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Factorize common migration incoming codeJuan Quintela2010-06-221-0/+2
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Exit if incoming migration failsJuan Quintela2010-06-221-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: respect exit status with exec:Anthony Liguori2010-06-031-1/+1
| | | | | | | | | This patch makes sure that if the exec: process exits with a non-zero return status, we treat the migration as failed. This fixes https://bugs.launchpad.net/qemu/+bug/391879 Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Monitor: Convert do_migrate() to cmd_new_ret()Luiz Capitulino2010-02-191-1/+1
| | | | | | | | While there I'm also dropping a unneeded else clause (the last one in the function). Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Monitor: Convert simple handlers to cmd_new_ret()Luiz Capitulino2010-02-191-4/+4
| | | | | | | | | | | | | | | | | The following handlers always succeed and hence can be converted to cmd_new_ret() in the same commit. - do_stop() - do_quit() - do_system_reset() - do_system_powerdown() - do_migrate_cancel() - do_qmp_capabilities() - do_migrate_set_speed() - do_migrate_set_downtime() Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: convert do_migrate_set_downtime() to QObjectMarkus Armbruster2010-02-031-1/+2
| | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: convert do_migrate_set_speed() to QObjectMarkus Armbruster2010-02-031-1/+1
| | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "monitor: Convert do_migrate_set_speed() to QObject"Anthony Liguori2009-12-191-1/+1
| | | | | | | | | | | | This reverts commit 3a4921047d514c336531c304bec362c4d138ebcc. From Luiz: do_migrate_set_speed() accepts a suffix for the 'value' argument and this is not good for QMP. We will have to add a new argument type to handle that and this will have to wait for 0.13. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: Convert do_info_migrate() to QObjectLuiz Capitulino2009-12-121-1/+3
| | | | | | | | | | | | | | Return a QDict, which may contain up to more two QDicts, depending on the type of migration we're performing. IMPORTANT: as a QInt stores a int64_t integer, RAM values are going to be stored as int64_t and not as uint64_t as they are today. If this is a problem QInt will have to be changed. This commit should not change user output. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* live migration: Propagate output monitor to callback handlerJan Kiszka2009-12-031-5/+8
| | | | | | | | | 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>
* Block live migrationlirans@il.ibm.com2009-11-171-5/+15
| | | | | | | | | | | | | | | | | | | 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>
* monitor: Convert do_migrate_cancel() to QObjectLuiz Capitulino2009-10-271-1/+1
| | | | | Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_migrate_set_speed() to QObjectLuiz Capitulino2009-10-271-1/+1
| | | | | Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Convert do_migrate() to QObjectLuiz Capitulino2009-10-271-1/+1
| | | | | | | | Error is still directly printed, as we are only converting regular output. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_2 to use QDictLuiz Capitulino2009-09-041-1/+1
| | | | | | | | This commit ports command handlers that receive two arguments to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_1 to use QDictLuiz Capitulino2009-09-041-2/+2
| | | | | | | | This commit ports command handlers that receive one argument to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_0 to use QDictLuiz Capitulino2009-09-041-1/+2
| | | | | | | | | | | | This commit ports command handlers that receive no arguments to use the new monitor's dictionary. It might seem no sense to do this, as the handlers have no arguments, but at the end of this porting work all handlers will have the same structure. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* add file descriptor migrationPaolo Bonzini2009-08-271-0/+7
| | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Chris Lalancette <clalance@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Migration via unix sockets.Chris Lalancette2009-08-241-0/+6
| | | | | | | | | | | | | | | | | | Implement migration via unix sockets. While you can fake this using exec and netcat, this involves forking another process and is generally not very nice. By doing this directly in qemu, we can avoid the copy through the external nc command. This is useful for implementations (such as libvirt) that want to do "secure" migration; we pipe the data on the sending side into the unix socket, libvirt picks it up, encrypts it, and transports it, and then on the remote side libvirt decrypts it, dumps it to another unix socket, and feeds it into qemu. The implementation is straightforward and looks very similar to migration-exec.c and migration-tcp.c Signed-off-by: Chris Lalancette <clalance@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* set migration max downtimeGlauber Costa2009-06-161-0/+2
| | | | | | | | | | | | 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>
* add non-arbitrary migration stop conditionGlauber Costa2009-06-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* monitor: Decouple terminals (Jan Kiszka)aliguori2009-03-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* monitor: Rework API (Jan Kiszka)aliguori2009-03-051-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove unnecessary trailing newlinesblueswir12008-12-131-1/+0
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6000 c046a42c-6fe2-441c-8c8c-71466251a162
* Reintroduce migrate-to-exec: support (Charles Duffy)aliguori2008-11-111-0/+49
| | | | | | | | | | | | | | | | | | | 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
* Introduce TCP live migration protocolaliguori2008-10-131-0/+6
| | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud