History | View | Annotate | Download (11.3 kB)
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.
Signed-off-by: Juan Quintela <quintela@redhat.com>
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
Monitor: Drop QMP documentation from code
Previous commit added QMP documentation to the qemu-monitor.hxfile, it's is a copy of this information.
While it's good to keep it near code, maintaining two copies ofthe same information is too hard and has little benefit as we...
Monitor: Convert do_migrate() to cmd_new_ret()
While there I'm also dropping a unneeded else clause (the lastone 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()
The following handlers always succeed and hence can be convertedto cmd_new_ret() in the same commit.
- do_stop()- do_quit()- do_system_reset()- do_system_powerdown()- do_migrate_cancel()- do_qmp_capabilities()...
Monitor: remove unneeded checks
It's not needed to check the return of qobject_from_jsonf()anymore, as an assert() has been added there.
Do not use dprintf
dprintf is already claimed by POSIX1, and on at least one systemis implemented as a macro
[1] http://www.opengroup.org/onlinepubs/9699919799/functions/dprintf.html
Signed-off-by: malc <av1474@comtv.ru>
monitor: Use argument type 'b' for migrate_set_speed
Before, it used type 's', which strips quotes and interprets escapes,and is quite inappropriate for QMP.
Negative arguments are no flushed to zero. Before, they were cast touint32_t, which wrecked the sign....
monitor: convert do_migrate_set_speed() to QObject
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Use argument type 'T' for migrate_set_downtime
monitor: convert do_migrate_set_downtime() to QObject
Revert "monitor: Convert do_migrate_set_speed() to QObject"
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...
migration: Convert do_info_migrate() to QObject
Return a QDict, which may contain up to more two QDicts, dependingon the type of migration we're performing.
IMPORTANT: as a QInt stores a int64_t integer, RAM values are goingto be stored as int64_t and not as uint64_t as they are today. If...
live migration: Allow cleanup after cancellation or error
Introduce qemu_savevm_state_cancel and inject a stage -1 to cancel alive migration. This gives the involved subsystems a chance to clean updynamically allocated resources. Namely, the block migration layer can...
live migration: Propagate output monitor to callback handler
In order to allow proper progress reporting to the monitor thatinitiated the migration, forward the monitor reference through themigration layer down to SaveLiveStateHandler.
block migration: Report progress also via info migration
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
migration: Fix use of file after release
qemu_fclose frees the passed file structure, but do_migrate_set_speedmay access it later on. Fix it by setting file NULL inmigrate_fd_cleanup and checking for this.
migration: Catch multiple start commands
Block live migration
This patch introduces block migration called during live migration. Blockare being copied to the destination in an async way. First the code willtransfer the whole disk and then transfer all dirty blocks accumulted duringthe migration....
monitor: Convert do_migrate() to QObject
Error is still directly printed, as we are only convertingregular output.
monitor: Convert do_migrate_set_speed() to QObject
monitor: Convert do_migrate_cancel() to QObject
monitor: Port handler_1 to use QDict
This commit ports command handlers that receive one argument to usethe new monitor's dictionary.
monitor: Port handler_2 to use QDict
This commit ports command handlers that receive two arguments to usethe new monitor's dictionary.
monitor: Port handler_0 to use QDict
This commit ports command handlers that receive no arguments to usethe 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...
add file descriptor migration
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.
Implement migration via unix sockets. While you can fake this usingexec and netcat, this involves forking another process and isgenerally not very nice. By doing this directly in qemu, we can avoidthe copy through the external nc command. This is useful for...
flush pending aio requests
When we finish migration, there may be pending async io requestsin flight. If we don't flush it before stage3 starting, it might bethe case that the guest loses it.
Signed-off-by: Glauber Costa <glommer@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Make sure to only vm_start() a failed migration if we were running to beginwith.
set migration max downtime
provide a monitor command to allow one to set the maximumdowntime 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...
add non-arbitrary migration stop condition
Currently, we're entering migration's stage 3 whena treshold of 10 pages remain to be transferred in the system.
This has hurt some users. However, any proposed threshold isarbitrary by nature, and would only shift the annoyance....
migrate_fd_close: delete associated io-handler before closing the fd
It may happen that the io-handler is still registered. That causesselect() to return with EBADF, not calling handlers for other fds.
The io-handler would be registered when (on the source) the whole state...
allow changing the speed of a running migration
This patch allow us to call migrate_set_speed on runningmigrations. This should allow mgmt tools to increase the allocatedbandwidth of a running migration if there is no progress, and theyreally want the migration to succeed....
augment info migrate with page status
This should be enough for management tools to realizewhether or not there is progress in migration. We can...