History | View | Annotate | Download (15.4 kB)
migration: move process_incoming_migration to a coroutine
The final part of incoming migration, which now consists ofprocess_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>
migration: use migrate_fd_close in migrate_fd_cleanup
migrate_fd_cleanup will usually close the file descriptor viabuffered_file_close's call to migrate_fd_close. However, in the caseof s->file == NULL it is "inlining" migrate_fd_close (almost: there is a...
migration: move qemu_fclose to process_incoming_migration
The common suffix is now just process_incoming_migration.
Merge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable
migration: go to paused state after finishing incoming migration with -S
At the end of migration the machine has started already, and cannot bedestroyed without losing the guest's data. Hence, prelaunch is thewrong state. Go to the paused state instead. QEMU would reach that...
migration: centralize call to migrate_fd_error()
The call to migrate_fd_error() was missing for non-socket backends, socentralize it in qmp_migrate().
Before:
(qemu) migrate fd:ffff migrate: An undefined error has occurred (qemu) info migrate...
migration: use qemu-sockets to establish Unix sockets
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>
migration (outgoing): add error propagation for all protocols
Error propagation is already there for socket backends. Add it to otherprotocols, simplifying code that tests for errors that will never happen.With all protocols understanding Error, the code can be simplified...
migration (incoming): add error propagation to fd and exec protocols
And remove the superfluous integer return value.
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
migration: avoid using error_is_set and thus relying on errp != NULL
The migration code is using errp to detect "internal" errors, this meansthat it relies on errp being non-NULL.
No impact so far because our only QMP clients (the QMP marshaller and HMP)...
savevm: make qemu_file_put_notify() return errors
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
buffered_file: unfold migrate_fd_wait_for_unfreeze
We only used it once, just remove the callback indirection.
buffered_file: unfold migrate_fd_close
buffered_file: We can access directly to bandwidth_limit
migration: make migrate_fd_wait_for_unfreeze() return errors
Adjust all callers
migration: store end_time in a local variable
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>
migration: print total downtime for final phase of migration
migration: export migrate_get_current()
migration: print expected downtime in info migrate
migration: Add dirty_pages_rate to query migrate output
It indicates how many pages were dirtied during the last second.
buffered_file: unfold migrate_fd_put_buffer
We only used it once, just remove the callback indirection
buffered_file: unfold migrate_fd_put_ready
We only use it once, just remove the callback indirection.
Clear handler only for valid fd
Signed-off-by: Orit Wasserman <owasserm@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
migration: move total_time from ram stats to migration info
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Add XBZRLE to ram_save_block and ram_save_live
In the outgoing migration check to see if the page is cached andchanged, then send compressed page by using save_xbrle_page function.In the incoming migration check to see if RAM_SAVE_FLAG_XBZRLE is setand decompress the page (by using load_xbrle function)....
Add migrate_set_cache_size command
Change XBZRLE cache size in bytes (the size should be a power of 2, it will berounded 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...
Add migration accounting for normal and duplicate pages
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>...
Add XBZRLE statistics
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>...
Add migration capabilities
The management can query the current migration capabilities usingquery-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>...
Add migrate-set-capabilities
The management can enable/disable a capability for the next migration by usingmigrate-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>...
Add spent time for migration
We add time spent for migration to the output of "info migrate" command. 'total_time' means time since the start fo migration ifmigration is 'active', and total time of migration if migration iscompleted. As we are also interested in transferred ram when...
Add MigrationParams structure
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
use inet_listen()/inet_connect() to support ipv6 migration
Use help functions in qemu-socket.c for tcp migration,which already support ipv6 addresses.
Currently errp will be set to UNDEFINED_ERROR when migration fails,qemu would output "migration failed: ...", and current user can...
wakeup on migration
Wakeup the guest when the live part of the migation is finished.This avoids being in suspended state on migration, so we don'thave to save the is_suspended bit.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
migration: clear BDRV_O_INCOMING flags on end of incoming live migration
Signed-off-by: Benoît Canet <benoit.canet@gmail.com>Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Purge migration of (almost) everything to do with monitors
The Monitor object is passed back and forth within the migration/savevmcode so that it can print errors and progress to the user.
However, that approach assumes a HMP monitor, being completely invalid...
qapi: Convert migrate
The migrate command is one of those commands where HMP and QMP completelymix up together. This made the conversion to the QAPI (which separates thecommand into QMP and HMP parts) a bit difficult.
The first important change to be noticed is that this commit completes the...
notifier: switch to QLIST
Notifiers do not need to access both ends of the list, and usinga QLIST also simplifies the API.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
prepare for future GPLv2+ relicensing
All files under GPLv2 will get GPLv2+ changes starting tomorrow.event_notifier.c and exec-obsolete.h were only ever touched by Red Hatemployees and can be relicensed now.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
migrate_fd_cleanup: accept any negative qemu_fclose() value as error
Also, we now return the qemu_fclose() value unchanged to the caller. Forreference, the migrate_fd_cleanup() callers are the following:
- migrate_fd_completed(): any negative value is considered an...
qapi: Convert migrate_cancel
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qapi: Convert migrate_set_downtime
qapi: Convert migrate_set_speed
block: allow migration to work with image files (v3)
Image files have two types of data: immutable data that describes things likeimage size, backing files, etc. and mutable data that includes offset andreference count tables.
Today, image formats aggressively cache mutable data to improve performance. In...
migrate: add migration blockers
This lets different subsystems register an Error that is thrown whenevermigration is attempted. This works nicely because it gracefully supportsthings like hotplug.
Right now, if multiple errors are registered, only one of them is reported....
migration: fix detached migration with fd
Migration with fd uses s->mon to pass the fd. But we only assign thes->mon for !detached migration. Fix it. Once there add a commentindicating that s->mon has two uses.
Bug reported by: Wen Congyang <wency@cn.fujitsu.com>...
Fix segfault on migration completion
A simple migration reproduces it:
1. Start the source VM with:
2. Start the destination VM with:
3. In the source VM:
(qemu) migrate -d tcp:0:4444...
Merge remote-tracking branch 'qmp/queue/qmp' into staging
Conflicts: ui/spice-core.c
qapi: Convert query-migrate
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
migration: add status query functions
Add migration_is_active and migration_has_failed functionsto query migration state.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Merge remote-tracking branch 'quintela/migration-pull' into staging
migration: Remove get_status() accessor
It is only used inside migration.c, and fields on that struct areaccessed all around the place on that file.
migration: Remove migration cancel() callback
It is used only in one place
migration: Move exported functions to the end of the file
This means we can remove the two forward declarations.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
migration: create accessor for current_migration
migration: Use bandwidth_limit directly
Now that current_migration always exist, there is no reason formax_throotle variable.
migration: Pass MigrationState in migration notifiers
migration: Export a function that tells if the migration has finished correctly
This will allow us to hide the state values.
migration: Make state definitions local
migration: Fold MigrationState into FdMigrationState
migration: Rename FdMigrationState MigrationState
migration: Refactor MigrationState creation
migration: Make all posible migration functions static
I have to move two functions postions to avoid forward declarations
migration: move migrate_new to do_migrate
Once there, remove all parameters that don't need to be passed to*start_outgoing_migration() functions
migration: Introduce MIG_STATE_SETUP
Use MIG_STATE_ACTIVE only when migration has really started. Use thisnew state to setup migration parameters. Change defines for ananonymous struct.
migration: Refactor and simplify error checking in migrate_fd_put_ready
migration: Introduce migrate_fd_completed() for consistency
This function is a bit different of the others that change the state,in the sense that if migrate_fd_cleanup() returns an error, it set thestatus to error, not completed.
migration: Our release callback was just free
We called it from a single place, and always with state !=MIG_STATE_ACTIVE. Just remove the whole callback. For users of thenotifier, 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...
migration: change has_error to contain errno values
We normally already have an errno value. When not, abuse EIO.
migration: return real error code
make functions propagate errno, instead of just using -EIO. Add acomment about what are the return value of qemu_savevm_state_iterate().
migration: rename qemu_file_has_error to qemu_file_get_error
Now the function returned errno, so it is better the new name.
migration: Make *start_outgoing_migration return FdMigrationState
migration: Use FdMigrationState instead of MigrationState when possible
migration: simplify state assignmente
Once there, make sure that if we already know that there is one error,just call migration_fd_cleanup() with the ERROR state.
migration: Check that migration is active before cancel it
migration: add error handling to migrate_fd_put_notify().
Although migrate_fd_put_buffer() sets MIG_STATE_ERROR if it failed,since migrate_fd_put_notify() isn't checking error of underlyingQEMUFile, those resources are kept open. This patch checks it and...
migration: don't "write" when migration is not active
If migration is not active, just ignore writes.
migration: set error if select return one error
runstate: Allow user to migrate twice
It should be a matter of allowing the transition POSTMIGRATE ->FINISH_MIGRATE, but it turns out that the VM won't do thetransition the second time because it's already stopped.
So this commit also adds vm_stop_force_state() which performs...
RunState: Rename enum values as generated by the QAPI
Next commit will convert the query-status command to use theRunState type as generated by the QAPI.
In order to "transparently" replace the current enum by the QAPIone, we have to make some changes to some enum values....
Replace the VMSTOP macros with a proper state type
Today, when notifying a VM state change with vm_state_notify(),we pass a VMSTOP macro as the 'reason' argument. This is not idealbecause the VMSTOP macros tell why qemu stopped and not exactlywhat the current VM state is....
RunState: Add additional states
Currently, only vm_start() and vm_stop() change the VM state.That's, the state is only changed when starting or stopping the VM.
This commit adds the runstate_set() function, which makes it possibleto also do state transitions when the VM is stopped or running....
Drop the incoming_expected global variable
Test against RSTATE_IN_MIGRATE instead.
Please, note that the RSTATE_IN_MIGRATE state is only set when all theinitial VM setup is done, while 'incoming_expected' was set right inthe beginning when parsing command-line options. Shouldn't be a problem...
Drop the vm_running global variable
Use runstate_is_running() instead, which is introduced by this commit.
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Reorganize and fix monitor resume after migration
If migration failed in migrate_fd_put_buffer, the monitor may have beenresumed not only in the error path of that function but also once againin migrate_fd_put_ready which is called unconditionally bymigrate_fd_connect....
notifier: Pass data argument to callback
This allows to pass additional information to the notifier callbackwhich is useful if sender and receiver do not share any other distinctdata structure.
Will be used first for the clock reset notifier.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
Improve vm_stop reason declarations
Define and use dedicated constants for vm_stop reasons, they actuallyhave nothing to do with the EXCP_* defines used so far. At this chance,specify more detailed reasons so that VM state change handlers canevaluate them....
add migration state change notifiers
This patch adds functions to register and unregister notifiers formigration state changes and a function to query the migration state.The notifier is called on every state change. Once after establishing anew migration object (which is in active state then) and once when the...
savevm: Fix no_migrate
The no_migrate save state flag is currently only checked in thelast phase of migration. This means that we potentially wastea lot of time and bandwidth with the live state handlers beforewe ever check the no_migrate flags. The error message printed...
migration/savevm: no need to flush requests
There's no need to flush requests after vmstopas vmstop does it for us automatically now.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Tested-by: Jason Wang <jasowang@redhat.com>
migration: allow rate > 4g
I'd like to disable bandwidth limit or make it very high,Use int64_t all over to make values >= 4g work.
Switch migrate_set_speed() to take an 'o' argument rather than a float.
Clarify default value of MB in migration speed argument in monitor, ifno suffix is specified. This differ from previous default of bytes,but is consistent with the rest of the places where we accept a size...
set proper migration status on ->write error (v5)
If ->write fails, declare migration status as MIG_STATE_ERROR.
Also, in buffered_file.c, ->close the object in case of anerror.
Fixes "migrate -d "exec:dd of=file", where dd fails to open file.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>...
migration: Accept 'cont' only after successful incoming migration
When a 'cont' is issued on a VM that's just waiting for an incomingmigration, the VM reboots and boots into the guest, possibly corruptingits storage since it could be shared with another VM running elsewhere....
Monitor: handle optional '-' arg as a bool
Historically, user monitor arguments beginning with '-' (eg. '-f')were passed as integers down to handlers.
I've maintained this behavior in the new monitor because we didn'thave a boolean type at the very beginning of QMP. Today we have it...
Exit if incoming migration fails
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Factorize common migration incoming code
migration: use qemu_free() instead of free().
Although there is no difference, other migration related code useqemu_free(), and it should be better to be consistent.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
migration: respect exit status with exec:
This patch makes sure that if the exec: process exits with a non-zero returnstatus, we treat the migration as failed.
This fixes https://bugs.launchpad.net/qemu/+bug/391879