aboutsummaryrefslogtreecommitdiff
path: root/migration.c
AgeCommit message (Collapse)AuthorFilesLines
2012-12-20migration: merge QEMUFileBuffered into MigrationStateJuan Quintela1-38/+25
Avoid splitting the state of outgoing migration, more or less arbitrarily, between two data structures. QEMUFileBuffered anyway is used only during migration. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: fix qemu_get_fd for BufferedFilePaolo Bonzini1-1/+1
Not really used, but nice to have it correct. :) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: move migration notifierJuan Quintela1-2/+1
At this point, it is waranteed that state is ACTIVE. Old position didn't assured hat. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: Inline qemu_fopen_ops_buffered into migrate_fd_connectJuan Quintela1-8/+3
Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: move migration_fd_put_ready()Juan Quintela1-65/+65
Put it near its use and un-export it. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: add XFER_LIMIT_RATIOJuan Quintela1-4/+6
The "magic" divisions by 10 are there because of the value of BUFFER_DELAY. Introduce a constant to explain them better. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: move buffered_file.c code into migration.cJuan Quintela1-1/+232
This only moves the code (also from buffered_file.h to migration.h). Fix whitespace until checkpatch is happy. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20savevm: New save live migration method: pendingJuan Quintela1-7/+15
Code just now does (simplified for clarity) if (qemu_savevm_state_iterate(s->file) == 1) { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); qemu_savevm_state_complete(s->file); } Problem here is that qemu_savevm_state_iterate() returns 1 when it knows that remaining memory to sent takes less than max downtime. But this means that we could end spending 2x max_downtime, one downtime in qemu_savevm_iterate, and the other in qemu_savevm_state_complete. Changed code to: pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); if (pending_size >= max_size) { ret = qemu_savevm_state_iterate(s->file); } else { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); qemu_savevm_state_complete(s->file); } So what we do is: at current network speed, we calculate the maximum number of bytes we can sent: max_size. Then we ask every save_live section how much they have pending. If they are less than max_size, we move to complete phase, otherwise we do an iterate one. This makes things much simpler, because now individual sections don't have to caluclate the bandwidth (it was implossible to do right from there). Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-20migration: just lock migrate_fd_put_readyJuan Quintela1-0/+5
Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: remove unfreeze logicJuan Quintela1-23/+0
Now that we have a thread, and blocking writes, we don't need it. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-20migration: make writes blockingJuan Quintela1-17/+0
Move all the writes to the migration_thread, and make writings blocking. Notice that are still using the iothread for everything that we do. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: move migration thread init code to migrate_fd_put_readyJuan Quintela1-12/+17
This way everything related with migration is run on the migration thread and no locking is needed. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: make qemu_fopen_ops_buffered() return voidJuan Quintela1-1/+1
We want the file assignment to happen before the thread is created to avoid locking, so we just do it before creating the thread. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
2012-12-20migration: remove double call to migrate_fd_closePaolo Bonzini1-1/+1
The call in buffered_close is enough, because buffered_close is called already by migrate_fd_cleanup. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-19softmmu: move include files to include/sysemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19migration: move include files to include/migration/Paolo Bonzini1-2/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19monitor: move include files to include/monitor/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19block: move include files to include/block/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-02migration: move process_incoming_migration to a coroutinePaolo Bonzini1-1/+20
The final part of incoming migration, which now consists of process_incoming_migration for all protocols, is thus made non-blocking. Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-02migration: move qemu_fclose to process_incoming_migrationPaolo Bonzini1-1/+5
The common suffix is now just process_incoming_migration. Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-02migration: use migrate_fd_close in migrate_fd_cleanupPaolo Bonzini1-11/+8
migrate_fd_cleanup will usually close the file descriptor via buffered_file_close's call to migrate_fd_close. However, in the case of s->file == NULL it is "inlining" migrate_fd_close (almost: there is a direct close() instead of using s->close(s)). To fix the inconsistency and clean up the code, allow multiple calls to migrate_fd_close and use the function in migrate_fd_cleanup. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-29Merge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstableAurelien Jarno1-1/+1
* 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable: migration: go to paused state after finishing incoming migration with -S qmp: handle stop/cont in INMIGRATE state hmp: fix info cpus for sparc targets
2012-10-24migration: go to paused state after finishing incoming migration with -SPaolo Bonzini1-1/+1
At the end of migration the machine has started already, and cannot be destroyed without losing the guest's data. Hence, prelaunch is the wrong state. Go to the paused state instead. QEMU would reach that state anyway (after running the guest for the blink of an eye) if the "stop" command had been received after the start of migration. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-10-23migration (incoming): add error propagation to fd and exec protocolsPaolo Bonzini1-9/+6
And remove the superfluous integer return value. Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23migration (outgoing): add error propagation for all protocolsPaolo Bonzini1-11/+6
Error propagation is already there for socket backends. Add it to other protocols, simplifying code that tests for errors that will never happen. With all protocols understanding Error, the code can be simplified further by removing the return value. Unfortunately, the quality of error messages varies depending on where the error is detected, because no Error is passed to the NonBlockingConnectHandler. Thus, the exact error message still cannot be sent to the user if the OS reports it asynchronously via SO_ERROR. If NonBlockingConnectHandler received an Error**, we could for example report the error class and/or message via a new field of the query-migration command even if it is reported asynchronously. Before: (qemu) migrate fd:ffff migrate: An undefined error has occurred (qemu) info migrate (qemu) After: (qemu) migrate fd:ffff migrate: File descriptor named 'ffff' has not been found (qemu) info migrate capabilities: xbzrle: off Migration status: failed total time: 0 milliseconds Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23migration: use qemu-sockets to establish Unix socketsPaolo Bonzini1-2/+2
This makes migration-unix.c again a cut-and-paste job from migration-tcp.c, exactly as it was in the beginning. :) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23migration: centralize call to migrate_fd_error()Paolo Bonzini1-0/+1
The call to migrate_fd_error() was missing for non-socket backends, so centralize it in qmp_migrate(). Before: (qemu) migrate fd:ffff migrate: An undefined error has occurred (qemu) info migrate (qemu) After: (qemu) migrate fd:ffff migrate: An undefined error has occurred (qemu) info migrate capabilities: xbzrle: off Migration status: failed total time: 0 milliseconds (The awful error message will be fixed later in the series). Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23migration: avoid using error_is_set and thus relying on errp != NULLPaolo Bonzini1-6/+7
The migration code is using errp to detect "internal" errors, this means that it relies on errp being non-NULL. No impact so far because our only QMP clients (the QMP marshaller and HMP) never pass a NULL Error **. But if we had others, this patch would make sure that migration can work with a NULL Error **. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-17savevm: make qemu_file_put_notify() return errorsJuan Quintela1-2/+3
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-17migration: make migrate_fd_wait_for_unfreeze() return errorsJuan Quintela1-3/+4
Adjust all callers Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-17buffered_file: We can access directly to bandwidth_limitJuan Quintela1-1/+1
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-17buffered_file: unfold migrate_fd_closeJuan Quintela1-6/+2
We only used it once, just remove the callback indirection. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-10-17buffered_file: unfold migrate_fd_wait_for_unfreezeJuan Quintela1-3/+1
We only used it once, just remove the callback indirection. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-10-17buffered_file: unfold migrate_fd_put_readyJuan Quintela1-3/+1
We only use it once, just remove the callback indirection. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-17buffered_file: unfold migrate_fd_put_bufferJuan Quintela1-4/+2
We only used it once, just remove the callback indirection Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-17migration: Add dirty_pages_rate to query migrate outputJuan Quintela1-0/+2
It indicates how many pages were dirtied during the last second. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-10-17migration: print expected downtime in info migrateJuan Quintela1-0/+2
Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-10-17migration: export migrate_get_current()Juan Quintela1-1/+1
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-17migration: print total downtime for final phase of migrationJuan Quintela1-1/+5
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
2012-10-17migration: store end_time in a local variableJuan Quintela1-1/+3
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
2012-09-25Clear handler only for valid fdOrit Wasserman1-1/+3
Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-08-21migration: move total_time from ram stats to migration infoJuan Quintela1-3/+4
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-08-08Add XBZRLE statisticsOrit Wasserman1-0/+17
Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-08Add migration accounting for normal and duplicate pagesOrit Wasserman1-0/+6
Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-08Add migrate_set_cache_size commandOrit Wasserman1-0/+19
Change XBZRLE cache size in bytes (the size should be a power of 2, it will be rounded down to the nearest power of 2). If XBZRLE cache size is too small there will be many cache miss. New query-migrate-cache-size QMP command and 'info migrate_cache_size' HMP command to query cache value. Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-08Add XBZRLE to ram_save_block and ram_save_liveOrit Wasserman1-0/+24
In the outgoing migration check to see if the page is cached and changed, then send compressed page by using save_xbrle_page function. In the incoming migration check to see if RAM_SAVE_FLAG_XBZRLE is set and decompress the page (by using load_xbrle function). Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-08Add migrate-set-capabilitiesOrit Wasserman1-0/+16
The management can enable/disable a capability for the next migration by using migrate-set-capabilities QMP command. The user can use migrate_set_capability HMP command. Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-08Add migration capabilitiesOrit Wasserman1-0/+30
The management can query the current migration capabilities using query-migrate-capabilities QMP command. The user can use 'info migrate_capabilities' HMP command. Currently only XBZRLE capability is available. Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-06-29Add spent time for migrationJuan Quintela1-0/+11
We add time spent for migration to the output of "info migrate" command. 'total_time' means time since the start fo migration if migration is 'active', and total time of migration if migration is completed. As we are also interested in transferred ram when migration completes, adding all ram statistics Signed-off-by: Juan Quintela <quintela@redhat.com>