summaryrefslogtreecommitdiffstats
path: root/migration/savevm.c
Commit message (Collapse)AuthorAgeFilesLines
* migration: normalize locking in migration/savevm.cDenis V. Lunev2015-11-191-1/+18
| | | | | | | | | | | | | basically all bdrv_* operations must be called under aio_context_acquire except ones with bdrv_all prefix. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> CC: Juan Quintela <quintela@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: implement bdrv_all_find_vmstate_bs helperDenis V. Lunev2015-11-191-15/+4
| | | | | | | | | | | | The patch also ensures proper locking for the operation. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: reorder processing in hmp_savevmDenis V. Lunev2015-11-191-9/+9
| | | | | | | | | | | | State deletion can be performed on running VM which reduces VM downtime This approach looks a bit more natural. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* snapshot: create bdrv_all_create_snapshot helperDenis V. Lunev2015-11-191-13/+4
| | | | | | | | | | | | | | to create snapshot for all loaded block drivers. The patch also ensures proper locking. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: drop find_vmstate_bs check in hmp_delvmDenis V. Lunev2015-11-191-5/+0
| | | | | | | | | | | There is no much sense to do the check and write warning. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* snapshot: create bdrv_all_find_snapshot helperDenis V. Lunev2015-11-191-33/+9
| | | | | | | | | | | | | | | | | to check that snapshot is available for all loaded block drivers. The check bs != bs1 in hmp_info_snapshots is an optimization. The check for availability of this snapshot will return always true as the list of snapshots was collected from that image. The patch also ensures proper locking. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: factor our snapshottability check in load_vmstateDenis V. Lunev2015-11-191-8/+7
| | | | | | | | | | | | | | We should check that all inserted and not read-only images support snapshotting. This could be made using already invented helper bdrv_all_can_snapshot(). Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* snapshot: create bdrv_all_goto_snapshot helperDenis V. Lunev2015-11-191-10/+5
| | | | | | | | | | | | | | | to switch to snapshot on all loaded block drivers. The patch also ensures proper locking. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* snapshot: create bdrv_all_delete_snapshot helperDenis V. Lunev2015-11-191-44/+10
| | | | | | | | | | | | | | to delete snapshots from all loaded block drivers. The patch also ensures proper locking. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* snapshot: create helper to test that block drivers supports snapshotsDenis V. Lunev2015-11-191-13/+4
| | | | | | | | | | | | | The patch enforces proper locking for this operation. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Tested-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Finish non-postcopiable iterative devices before packageDr. David Alan Gilbert2015-11-121-2/+8
| | | | | | | | | | Where we have iterable, but non-postcopiable devices (e.g. htab or block migration), complete them before forming the 'package' but with the CPUs stopped. This stops them filling up the package. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: qemu_savevm_state_cleanup becomes mandatory operationDenis V. Lunev2015-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | since commit commit 94f5a43704129ca4995aa3385303c5ae225bde42 Author: Liang Li <liang.z.li@intel.com> Date: Mon Nov 2 15:37:00 2015 +0800 migration: defer migration_end & blk_mig_cleanup when actual .cleanup callbacks calling was removed from complete operations. The patch fixes regression introduced by the commit above results in 100% reliable assert for virtio-scsi VM with iothreads enabled during 'virsh create-snapshot' operation: assert(i != mr->ioeventfd_nb); memory_region_del_eventfd virtio_pci_set_host_notifier_internal virtio_pci_set_host_notifier virtio_scsi_dataplane_start virtio_scsi_handle_cmd virtio_queue_notify_vq virtio_queue_host_notifier_read aio_dispatch Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Liang Li <liang.z.li@intel.com> Reviewed-by: Juan Quintela <quintela@redhat.com> CC: Paolo Bonzini <pbonzini@redhat.com> CC: Juan Quintela <quintela@redhat.com> CC: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Postcopy: Mark nohugepage before discardDr. David Alan Gilbert2015-11-101-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | Prior to servicing userfault requests we must ensure we've not got huge pages in the area that might include non-transferred memory, since a hugepage could incorrectly mark the whole huge page as present. We mark the area as non-huge page (nhp) just before we perform discards; the discard code now tells us to discard any areas that haven't been sent (as well as any that are redirtied); any already formed transparent-huge-pages get fragmented by this discard process if they cotnain any discards. Transparent huge pages that have been entirely transferred and don't contain any discards are not broken by this mechanism; they stay as huge pages. By starting postcopy after a full precopy pass, many of the pages then stay as huge pages; this is important for maintaining performance after the end of the migration. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* postcopy: Wire up loadvm_postcopy_handle_ commandsDr. David Alan Gilbert2015-11-101-1/+27
| | | | | | | | | | | Wire up more of the handlers for the commands on the destination side, in particular loadvm_postcopy_handle_run now has enough to start the guest running. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Start up a postcopy/listener thread ready for incoming page dataDr. David Alan Gilbert2015-11-101-1/+78
| | | | | | | | | | | | The loading of a device state (during postcopy) may access guest memory that's still on the source machine and thus might need a page fill; split off a separate thread that handles the incoming page data so that the original incoming migration code can finish off the device data. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Don't iterate on precopy-only devices during postcopyDr. David Alan Gilbert2015-11-101-2/+11
| | | | | | | | | | During the postcopy phase we must not call the iterate method on precopy-only devices, since they may have done some cleanup during the _complete call at the end of the precopy phase. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* postcopy: ram_enable_notify to switch on userfaultDr. David Alan Gilbert2015-11-101-0/+9
| | | | | | | | | | | | Mark the area of RAM as 'userfault' Start up a fault-thread to handle any userfaults we might receive from it (to be filled in later) Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* postcopy: Incoming initialisationDr. David Alan Gilbert2015-11-101-0/+6
| | | | | | | | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration_completion: Take current stateDr. David Alan Gilbert2015-11-101-2/+0
| | | | | | | | | | Soon we'll be in either ACTIVE or POSTCOPY_ACTIVE when we complete migration, and we need to know which we expect to be in to change state safely. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Add qemu_savevm_state_complete_postcopyDr. David Alan Gilbert2015-11-101-2/+47
| | | | | | | | | | | | | | | | | | Add qemu_savevm_state_complete_postcopy to complement qemu_savevm_state_complete_precopy together with a new save_live_complete_postcopy method on devices. The save_live_complete_precopy method is called on all devices during a precopy migration, and all non-postcopy devices during a postcopy migration at the transition. The save_live_complete_postcopy method is called at the end of postcopy for all postcopiable devices. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Avoid sending vmdescription during postcopyDr. David Alan Gilbert2015-11-101-1/+2
| | | | | | | | | | | VMDescription is normally sent at the end, after all of the devices; however that's not the end for postcopy, so just don't send it when in postcopy. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* postcopy: OS support testDr. David Alan Gilbert2015-11-101-0/+5
| | | | | | | | | | | | Provide a check to see if the OS we're running on has all the bits needed for postcopy. Creates postcopy-ram.c which will get most of the other helpers we need. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Modify save_live_pending for postcopyDr. David Alan Gilbert2015-11-101-4/+13
| | | | | | | | | | Modify save_live_pending to return separate postcopiable and non-postcopiable counts. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* MIG_CMD_PACKAGED: Send a packaged chunk of migration streamDr. David Alan Gilbert2015-11-101-5/+99
| | | | | | | | | | | | | | | MIG_CMD_PACKAGED is a migration command that wraps a chunk of migration stream inside a package whose length can be determined purely by reading its header. The destination guarantees that the whole MIG_CMD_PACKAGED is read off the stream prior to parsing the contents. This is used by postcopy to load device state (from the package) while leaving the main stream free to receive memory pages. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Add wrappers and handlers for sending/receiving the postcopy-ram migration ↵Dr. David Alan Gilbert2015-11-101-0/+254
| | | | | | | | | | | | | messages. The state of the postcopy process is managed via a series of messages; * Add wrappers and handlers for sending/receiving these messages * Add state variable that track the current state of postcopy Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Rework loadvm path for subloopsDr. David Alan Gilbert2015-11-101-67/+74
| | | | | | | | | | | | | | | | Postcopy needs to have two migration streams loading concurrently; one from memory (with the device state) and the other from the fd with the memory transactions. Split the core of qemu_loadvm_state out so we can use it for both. Allow the inner loadvm loop to quit and cause the parent loops to exit as well. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Return path: Send responses from destination to sourceDr. David Alan Gilbert2015-11-101-1/+1
| | | | | | | | | | | | | | Add migrate_send_rp_message to send a message from destination to source along the return path. (It uses a mutex to let it be called from multiple threads) Add migrate_send_rp_shut to send a 'shut' message to indicate the destination is finished with the RP. Add migrate_send_rp_ack to send a 'PONG' message in response to a PING Use it in the MSG_RP_PING handler Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Return path: Control commandsDr. David Alan Gilbert2015-11-101-1/+42
| | | | | | | | | | | Add two src->dest commands: * OPEN_RETURN_PATH - To request that the destination open the return path * PING - Request an acknowledge from the destination Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Migration commandsDr. David Alan Gilbert2015-11-101-0/+71
| | | | | | | | | | | | | Create QEMU_VM_COMMAND section type for sending commands from source to destination. These commands are not intended to convey guest state but to control the migration process. For use in postcopy. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Rename save_live_complete to save_live_complete_precopyDr. David Alan Gilbert2015-11-101-5/+5
| | | | | | | | | | | In postcopy we're going to need to perform the complete phase for postcopiable devices at a different point, start out by renaming all of the 'complete's to make the difference obvious. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migrate_init: Call from savevmDr. David Alan Gilbert2015-11-101-0/+2
| | | | | | | | | | | | Suspend to file is very much like a migrate, and it makes life easier if we have the Migration state available, so initialise it in the savevm.c code for suspending. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewd-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Move configuration section writingDr. David Alan Gilbert2015-11-101-5/+6
| | | | | | | | | | | | | | | | The vmstate_configuration is currently written in 'qemu_savevm_state_begin', move it to 'qemu_savevm_state_header' since it's got a hard requirement that it must be the 1st thing after the header. (In postcopy some 'command' sections get sent early before the saving of the main sections and hence before qemu_savevm_state_begin). Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: rename cancel to cleanup in SaveVMHandlesLiang Li2015-11-041-2/+2
| | | | | | | | | 'cleanup' seems more appropriate than 'cancel'. Signed-off-by: Liang Li <liang.z.li@intel.com> Reviewed-by: Juan Quintela <quintela@redhat.com>al3 Reviewed-by: Amit Shah <amit.shah@redhat.com>al3 Signed-off-by: Juan Quintela <quintela@redhat.com>al3
* migration: rename qemu_savevm_state_cancelLiang Li2015-11-041-3/+3
| | | | | | | | | | | The function qemu_savevm_state_cancel is called after the migration in migration_thread, it seems strange to 'cancel' it after completion, rename it to qemu_savevm_state_cleanup looks better. Signed-off-by: Liang Li <liang.z.li@intel.com> Reviewed-by: Juan Quintela <quintela@redhat.com>al3 Reviewed-by: Amit Shah <amit.shah@redhat.com>al3 Signed-off-by: Juan Quintela <quintela@redhat.com>al3
* migration: Use g_new() & friends where that makes obvious senseMarkus Armbruster2015-09-291-6/+6
| | | | | | | | | | | | | | | | | g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. This commit only touches allocations with size arguments of the form sizeof(T). Same Coccinelle semantic patch as in commit b45c03f. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1442231491-23352-1-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* migration: size_t'ify some of qemu-fileDr. David Alan Gilbert2015-09-291-3/+4
| | | | | | | | | | | | | | | This is a start on using size_t more in qemu-file and friends; it fixes up QEMUFilePutBufferFunc and QEMUFileGetBufferFunc to take size_t lengths and return ssize_t return values (like read(2)) and fixes up all the different implementations of them. Note that I've not yet followed this deeply into bdrv_ implementations. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <1439463094-5394-5-git-send-email-dgilbert@redhat.com> Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* maint: avoid useless "if (foo) free(foo)" patternDaniel P. Berrange2015-09-111-6/+2
| | | | | | | | | | | | The free() and g_free() functions both happily accept NULL on any platform QEMU builds on. As such putting a conditional 'if (foo)' check before calls to 'free(foo)' merely serves to bloat the lines of code. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* migration: Fix global state with Xen.Anthony PERARD2015-08-031-0/+1
| | | | | | | | | | | | | | When doing migration via the QMP command xen_save_devices_state, the current runstate is not store into the global state section. Also the current runstate is not the one we want on the receiver side. During migration, the Xen toolstack paused QEMU before save the devices state. Also, the toolstack expect QEMU to autostart when the migration is finished. So this patch store "running" as it's current runstate. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* migration: We also want to store the global state for savevmJuan Quintela2015-07-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit df4b1024526cae3479da3492d6371fd4a7324a03 introduced global_state section. But it only filled the state while doing migration. While doing a savevm, we stored an empty string as state. So when we did a loadvm, it complained that state was invalid. Fedora 21, 4.1.1, qemu 2.4.0-rc0 > ../../configure --target-list="x86_64-softmmu" 068 2s ... - output mismatch (see 068.out.bad) --- /home/bos/jhuston/src/qemu/tests/qemu-iotests/068.out 2015-07-08 17:56:18.588164979 -0400 +++ 068.out.bad 2015-07-09 17:39:58.636651317 -0400 @@ -6,6 +6,8 @@ QEMU X.Y.Z monitor - type 'help' for more information (qemu) savevm 0 (qemu) quit +qemu-system-x86_64: Unknown savevm section or instance 'globalstate' 0 +qemu-system-x86_64: Error -22 while loading VM state QEMU X.Y.Z monitor - type 'help' for more information (qemu) quit *** done Failures: 068 Failed 1 of 1 tests Actually, there were two problems here: - we registered global_state too late for load_vm (fixed on another patch on the list) - we didn't store a valid state for savevm (fixed by this patch). Reported-by: John Snow <jsnow@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
* check_section_footers: Check the correct section_idDr. David Alan Gilbert2015-07-071-37/+37
| | | | | | | | | | | | The section footers check was incorrectly checking the section_id in the SaveStateEntry not the LoadStateEntry. These can validly be different if the two QEMU instances have instantiated their devices in a different order. The test only cares that we're finishing the same section we started, and hence it's the LoadStateEntry that we care about. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Add configuration sectionJuan Quintela2015-07-071-0/+61
| | | | | | | | | | | It needs to be the first one and it is not optional, that is the reason why it is opencoded. For new machine types, it is required that machine type name is the same in both sides. It is just done right now for pc's. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* vmstate: Create optional sectionsJuan Quintela2015-07-071-0/+8
| | | | | | | To make sections optional, we need to do it at the beggining of the code. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* Only try and read a VMDescription if it should be thereDr. David Alan Gilbert2015-07-071-9/+28
| | | | | | | | | | | | The VMDescription section maybe after the EOF mark, the current code does a 'qemu_get_byte' and either gets the header byte identifying the description or an error (which it ignores). Doing the 'get' upsets RDMA which hangs on old machine types without the VMDescription. Just avoid reading the VMDescription if we wouldn't send it. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Include qapi/qmp/qerror.h exactly where neededMarkus Armbruster2015-06-221-0/+1
| | | | | | | | | In particular, don't include it into headers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* qerror: Move #include out of qerror.hMarkus Armbruster2015-06-221-0/+1
| | | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* qerror: Clean up QERR_ macros to expand into a single stringMarkus Armbruster2015-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | These macros expand into error class enumeration constant, comma, string. Unclean. Has been that way since commit 13f59ae. The error class is always ERROR_CLASS_GENERIC_ERROR since the previous commit. Clean up as follows: * Prepend every use of a QERR_ macro by ERROR_CLASS_GENERIC_ERROR, and delete it from the QERR_ macro. No change after preprocessing. * Rewrite error_set(ERROR_CLASS_GENERIC_ERROR, ...) into error_setg(...). Again, no change after preprocessing. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* Add a protective section footerDr. David Alan Gilbert2015-06-121-0/+61
| | | | | | | | | | | | | | | | | | | | | Badly formatted migration streams can go undetected or produce misleading errors due to a lock of checking at the end of sections. In particular a section that adds an extra 0x00 at the end causes what looks like a normal end of stream and thus doesn't produce any errors, and something that ends in a 0x01..0x04 kind of look like real section headers and then fail when the section parser tries to figure out which section they are. This is made worse by the choice of 0x00..0x04 being small numbers that are particularly common in normal section data. This patch adds a section footer consisting of a marker (0x7e - ~) followed by the section-id that was also sent in the header. If they mismatch then it throws an error explaining which section was being loaded. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Disable section footers on older machine typesDr. David Alan Gilbert2015-06-121-0/+7
| | | | | | | | | | The next patch adds section footers; but we don't want to break migration compatibility so disable them on older machine types Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Merge section header writingDr. David Alan Gilbert2015-06-121-44/+28
| | | | | | | | | The header writing for device sections is open coded in a few places, merge it into one. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Move loadvm_handlers into MigrationIncomingStateDr. David Alan Gilbert2015-06-121-12/+16
| | | | | | | | | | | In postcopy we need the loadvm_handlers to be used in a couple of different instances of the loadvm loop/routine, and thus it can't be local any more. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
OpenPOWER on IntegriCloud