summaryrefslogtreecommitdiff
path: root/block-migration.c
AgeCommit message (Collapse)AuthorFilesLines
2012-03-15Purge migration of (almost) everything to do with monitorsLuiz Capitulino1-33/+25
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>
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-15block: bdrv_aio_* do not return NULLPaolo Bonzini1-13/+0
Initially done with the following semantic patch: @ rule1 @ expression E; statement S; @@ E = ( bdrv_aio_readv | bdrv_aio_writev | bdrv_aio_flush | bdrv_aio_discard | bdrv_aio_ioctl ) (...); ( - if (E == NULL) { ... } | - if (E) { <... S ...> } ) which however missed the occurrence in block/blkverify.c (as it should have done), and left behind some unused variables. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-05block: convert qemu_aio_flush() calls to bdrv_drain_all()Stefan Hajnoczi1-1/+1
Many places in QEMU call qemu_aio_flush() to complete all pending asynchronous I/O. Most of these places actually want to drain all block requests but there is no block layer API to do so. This patch introduces the bdrv_drain_all() API to wait for requests across all BlockDriverStates to complete. As a bonus we perform checks after qemu_aio_wait() to ensure that requests really have finished. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-17Fix some spelling bugs in documentation and commentsStefan Weil1-1/+1
These errors were detected by codespell: remaing -> remaining soley -> solely virutal -> virtual seperate -> separate libcacard.txt still needs some more patches. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-10-20migration: make *save_live return errorsJuan Quintela1-6/+11
Make *save_live() return negative values when there is one error, and updates all callers to check for the error. Signed-off-by: Juan Quintela <quintela@redhat.com>
2011-10-20migration: use qemu_file_get_error() return value when possibleJuan Quintela1-3/+4
Signed-off-by: Juan Quintela <quintela@redhat.com>
2011-10-20migration: rename qemu_file_has_error to qemu_file_get_errorJuan Quintela1-4/+4
Now the function returned errno, so it is better the new name. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-20migration: change has_error to contain errno valuesJuan Quintela1-5/+6
We normally already have an errno value. When not, abuse EIO. Signed-off-by: Juan Quintela <quintela@redhat.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-20/+20
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-24Strip trailing '\n' from error_report()'s first argumentMarkus Armbruster1-1/+1
error_report() prepends location, and appends a newline. The message constructed from the arguments should not contain a newline. Fix the obvious offenders. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-04-27Improve accuracy of block migration bandwidth calculationAvishay Traeger1-12/+11
block_mig_state.total_time is currently the sum of the read request latencies. This is not very accurate because block migration uses aio and so several requests can be submitted at once. Bandwidth should be computed with wall-clock time, not by adding the latencies. In this case, "total_time" has a higher value than it should, and so the computed bandwidth is lower than it is in reality. This means that migration can take longer than it needs to. However, we don't want to use pure wall-clock time here. We are computing bandwidth in the asynchronous phase, where the migration repeatedly wakes up and sends some aio requests. The computed bandwidth will be used for synchronous transfer. Signed-off-by: Avishay Traeger <avishay@il.ibm.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-04-07Fix integer overflow in block migration bandwidth calculationAvishay Traeger1-1/+1
block_mig_state.reads is an int, and multiplying by BLOCK_SIZE yielded a negative number, resulting in a negative bandwidth (running on a 32-bit machine). Change order to avoid. Signed-off-by: Avishay Traeger <avishay@il.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-02-07block: enable in_use flagMarcelo Tosatti1-0/+2
Set block device in use during block migration, disallow drive_del and bdrv_truncate for in use devices. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-02-07block-migration: add reference to target DriveInfoMarcelo Tosatti1-0/+3
So that ejection of attached device by guest does not free data in use by block migration instance. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> CC: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-02-07block-migration: actually disable dirty tracking on cleanupMarcelo Tosatti1-2/+2
Call to set_dirty_tracking() is misplaced. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-24Fix block migration when the device size is not a multiple of 1 MBPierre Riteau1-2/+20
b02bea3a85cc939f09aa674a3f1e4f36d418c007 added a check on the return value of bdrv_write and aborts migration when it fails. However, if the size of the block device to migrate is not a multiple of BLOCK_SIZE (currently 1 MB), the last bdrv_write will fail with -EIO. Fixed by calling bdrv_write with the correct size of the last block. Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-24Avoid divide by zero when there is no block device to migratePierre Riteau1-1/+6
When block migration is requested and no read-write block device is present, a divide by zero exception is triggered because total_sector_sum equals zero. Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24block migration: do not submit multiple AIOs for same sector (v2)Marcelo Tosatti1-9/+5
An old version of this patch was applied to master, so this contains the differences between v1 and v2. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-21block migration: do not submit multiple AIOs for same sectorMarcelo Tosatti1-0/+61
Block migration can submit multiple AIO reads for the same sector/chunk, but completion of such reads can happen out of order: migration guest - get_dirty(N) - aio_read(N) - clear_dirty(N) write(N) set_dirty(N) - get_dirty(N) - aio_read(N) If the first aio_read completes after the second, stale data will be migrated to the destination. Fix by not allowing multiple AIOs inflight for the same sector. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-08-03block migration: replace tabs by spaces.Yoshiaki Tamura1-6/+6
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-26block migration: propagate return value when bdrv_write() returns < 0Yoshiaki Tamura1-1/+5
Currently block_load() doesn't check return value of bdrv_write(), and even the destination weren't prepared to execute block migration, it proceeds and guest boots on the target. This patch fix this issue. Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-13Block migration fail, ignore error from bdrv_getlengthShahar Havivi1-1/+1
When there is no block driver associate with BlockDriverState bdrv_getlength returns -ENOMEDIUM that cause block migration to fail Signed-off-by: Shahar Havivi <shaharh@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-06Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori1-1/+1
2010-07-06savevm: Add DeviceState paramAlex Williamson1-2/+2
When available, we'd like to be able to access the DeviceState when registering a savevm. For buses with a get_dev_path() function, this will allow us to create more unique savevm id strings. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06block migration: Fix test for read-only driveMarkus Armbruster1-1/+1
init_blk_migration_it() skips drives with type hint BDRV_TYPE_CDROM. The intention is to skip read-only drives. However, BDRV_TYPE_CDROM is only a hint. It is currently sufficent for read-only. But it's not necessary, and it may not remain sufficient. Use bdrv_is_read_only() instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-04-23block: Do not export bdrv_firstStefan Hajnoczi1-30/+33
The bdrv_first linked list of BlockDriverStates is currently extern so that block migration can iterate the list. However, since there is already a bdrv_iterate() function there is no need to expose bdrv_first. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-02-09Try not to exceed max downtime on stage3Liran Schour1-9/+70
Move to stage3 only when remaining work can be done below max downtime. Use qemu_get_clock_ns for measuring read performance. Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-09Tranfer dirty blocks during iterative phaseLiran Schour1-36/+99
Start transfer dirty blocks during the iterative stage. That will reduce the time that the guest will be suspended Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-09Remove unused codeLiran Schour1-43/+18
blk_mig_save_bulked_block is never called with sync flag. Remove the sync flag. Calculate bulk completion during blk_mig_save_bulked_block. Remove unused constants. Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-07Do not use dprintfmalc1-5/+5
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-03block migration: Skip zero-sized disksJan Kiszka1-2/+8
No need to migrate emptiness (risking divide by zero later on). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Add support for restore progress reportingJan Kiszka1-8/+22
Inject progress report in percentage into the block live stream. This can be read out and displayed easily on restore. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Report progress also via info migrationJan Kiszka1-0/+32
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Fix outgoing progress outputJan Kiszka1-24/+30
Report progress of an outgoing live migration to the monitor instead of stdout. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03live migration: Propagate output monitor to callback handlerJan Kiszka1-1/+1
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-12-03block migration: Report overall migration progressJan Kiszka1-16/+30
So far progress reporting only works for the first block device. Fix this by keeping an overall sum of sectors to be migratated, calculating the sum of all processed sectors, and finally basing the progress display on those values. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03live migration: Allow cleanup after cancellation or errorJan Kiszka1-6/+30
Introduce qemu_savevm_state_cancel and inject a stage -1 to cancel a live migration. This gives the involved subsystems a chance to clean up dynamically allocated resources. Namely, the block migration layer can now free its device descriptors and pending blocks. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Add error handling/propagationJan Kiszka1-16/+41
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Consolidate block transmissionJan Kiszka1-65/+39
Based on the original patch by Pierre Riteau: Use a common blk_send function to transmit a block. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Consolidate mig_read_device_bulk into mig_save_device_bulkJan Kiszka1-99/+50
Both functions share a lot of code, so make them one. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Clean up use of total_sectorsJan Kiszka1-3/+3
We already save total_sectors in BlkMigDevState, let's use this value during the migration and avoid to recalculate it needlessly. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Initialize remaining BlkMigState fieldsJan Kiszka1-0/+5
In case we restart a migration, submitted, read_done, transferred, and print_completion need to be reinitialized to 0. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Switch device and block lists to QSIMPLEQJan Kiszka1-35/+22
Based on the original patch by Pierre Riteau. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Drop dead codeJan Kiszka1-24/+0
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Avoid indirection of block_mig_stateJan Kiszka1-47/+44
No need to push block_mig_state to the heap and, thus, establish an indirection. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Avoid large stack bufferJan Kiszka1-5/+9
Move a potentially large buffer from stack to heap. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Rework constants APIJan Kiszka1-36/+27
Instead of duplicating the definition of constants or introducing trivial retrieval functions move the SECTOR constants into the public block API. This also obsoletes sector_per_block in BlkMigState. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03block migration: Fix coding style and whitespacesJan Kiszka1-206/+184
No functional changes. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-17Fix mingw32 buildBlue Swirl1-1/+0
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>