summaryrefslogtreecommitdiffstats
path: root/migration
Commit message (Collapse)AuthorAgeFilesLines
* migration: Expose 'cancelling' status to userzhanghailiang2015-03-171-5/+1
| | | | | | | | | | | | | | | | | | | | | 'cancelling' status was introduced by commit 51cf4c1a, mainly to avoid a possible start of a new migration process while the previous one still exists. But we didn't expose this status to user, instead we returned the 'active' state. Here, we expose it to the user (such as libvirt), 'cancelling' status only occurs for a short window before the migration aborts, so for users, if they cancel a migration process, it will observe 'cancelling' status occasionally. Testing revealed that with older libvirt (anything 1.2.13 or less) will print an odd error message if the state is seen, but that the migration is still properly cancelled. Newer libvirt will be patched to recognize the new state without the odd error message. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Eric Blake <eblake@redhat.com> Cc: libvir-list@redhat.com Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Convert 'status' of MigrationInfo to use an enum typezhanghailiang2015-03-171-15/+5
| | | | | | | | | | | | | | The original 'status' is an open-coded 'str' type, convert it to use an enum type. This conversion is backwards compatible, better documented and more convenient for future extensibility. In addition, Fix a typo for qapi-schema.json (just remove the typo) : s/'completed'. 'comppleted' (since 1.2)/'completed' (since 1.2) Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Rename abbreviated macro MIG_STATE_* to MIGRATION_STATUS_*zhanghailiang2015-03-171-43/+50
| | | | | | | | | | Rename all macro MIG_STATE_* to MIGRATION_STATUS_* except "MIG_STATE_ERROR", we rename it to "MIGRATION_STATUS_FAILED" which will match the migration status string 'failed'. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Remove unused functionsThomas Huth2015-03-172-40/+0
| | | | | | | | | | migrate_rdma_pin_all() and qsb_clone() are completely unused and thus can be deleted. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Cc: Juan Quintela <quintela@redhat.com> Cc: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migrate_incoming: Cleanup/clarify error messagesDr. David Alan Gilbert2015-03-171-2/+6
| | | | | | | | | | | | | | Create a separate error for the case where migrate_incoming is used after a succesful migrate_incoming. Reword the error in the case where '-incoming defer' is missing to omit the command name so it's right for both hmp and qmp. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Fix remaining 32 bit compiler errorsStefan Weil2015-03-171-24/+29
| | | | | | | | Fix type casts between pointers and 64 bit integers. Now 32 bit builds are possible again. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Fix some 32 bit compiler errorsStefan Weil2015-03-171-12/+11
| | | | | | | | | | The current code won't compile on 32 bit hosts because there are lots of type casts between pointers and 64 bit integers. Fix some of them. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration/rdma: clean up qemu_rdma_dest_init a bitMichael Tokarev2015-03-171-29/+22
| | | | | | | | | | | | | | | | | Do not check for rdma->host being empty twice. This removes a large "if" block, so code indentation is changed. While at it, remove an ugly goto from the loop, replacing it with a cleaner if logic. And finally, there's no need to initialize `ret' variable since is always has a value. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Tested-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -- fixed space detected by Dave Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Avoid qerror_report_err() outside QMP command handlersMarkus Armbruster2015-03-171-2/+1
| | | | | | | | | | | qerror_report_err() is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. Replace by error_report_err() in process_incoming_migration_co(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell2015-03-161-2/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Block patches for 2.3-rc0 # gpg: Signature made Mon Mar 16 16:11:55 2015 GMT using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: block/vpc: remove disabled code from get_sector_offset block/vpc: rename footer->size -> footer->current_size block/vpc: make calculate_geometry spec conform vpc: Ignore geometry for large images block/vpc: optimize vpc_co_get_block_status block: Drop bdrv_find blockdev: Convert bdrv_find to blk_by_name migration: Convert bdrv_find to blk_by_name monitor: Convert bdrv_find to blk_by_name iotests: Test non-self-referential qcow2 refblocks iotests: Add tests for refcount table growth qcow2: Respect new_block in alloc_refcount_block() qemu-img: Avoid qerror_report_err() outside QMP handlers, again block: Fix block-set-write-threshold not to use funky error class block: Deprecate QCOW/QCOW2 encryption qemu-img: Fix convert, amend error messages for unknown options iotests: Update 051's reference output Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * migration: Convert bdrv_find to blk_by_nameFam Zheng2015-03-161-2/+5
| | | | | | | | | | | | | | Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1425296209-1476-3-git-send-email-famz@redhat.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
* | ram: make all save_page functions take a uint64_t parameterJuan Quintela2015-03-162-2/+3
| | | | | | | | | | | | | | | | It used to be an int, but then we can't pass directly the bytes_transferred parameter, that would happen later in the series. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com>
* | Add migrate_incomingDr. David Alan Gilbert2015-03-161-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add migrate_incoming/migrate-incoming to start an incoming migration. Once a qemu has been started with -incoming defer the migration can be started by issuing: migrate_incoming uri Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* | Add -incoming deferDr. David Alan Gilbert2015-03-161-6/+23
|/ | | | | | | | | | -incoming defer causes qemu to wait for an incoming migration to be specified later. The monitor can be used to set migration capabilities that may affect the incoming connection process. 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: Fix coding style (whitespace issues)Stefan Weil2015-03-101-10/+10
| | | | | | | | | | | * Remove trailing whitespace (fixes 9 errors from checkpatch.pl). One comment line was longer than 80 characters, so wrap it and fix a typo, too. * Replace tabs by blanks (fixes 1 error). Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* Remove superfluous '\n' around error_report()Gonglei2015-03-101-1/+1
| | | | | | Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* Add copyright and author after file splitStefan Berger2015-03-101-0/+4
| | | | | | Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* unbreak dtrace tracing due to double _ in rdma namesDr. David Alan Gilbert2015-03-021-13/+11
| | | | | | | | | | | | | | | | It looks like the dtrace trace code gets upset if you have trace names with __ in, which the migration/rdma.c code does. Rename the functions and the associated traces. Fixes: 733252deb8b7d37beacda5976c2769e18642b2fa Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reported-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Andreas Färber <afaerber@suse.de> Message-id: 1424105885-12149-1-git-send-email-dgilbert@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* migration: Fix warnings caused by missing 'static' attributeStefan Weil2015-02-101-4/+4
| | | | | | | | | | | | | | | | | | Warnings from the Sparse static analysis tool: migration-rdma.c:151:12: warning: symbol 'wrid_desc' was not declared. Should it be static? migration-rdma.c:190:12: warning: symbol 'control_desc' was not declared. Should it be static? migration-rdma.c:3301:19: warning: symbol 'rdma_read_ops' was not declared. Should it be static? migration-rdma.c:3308:19: warning: symbol 'rdma_write_ops' was not declared. Should it be static? Cc: Juan Quintela <quintela@redhat.com> Cc: Amit Shah <amit.shah@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* rdma: g_malloc0() can't fail, bury dead error handlingMarkus Armbruster2015-02-101-3/+0
| | | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* Tracify migration/rdma.cDr. David Alan Gilbert2015-02-051-189/+144
| | | | | | | | | Turn all the D/DD/DDDPRINTFs into trace events Turn most of the fprintf(stderr, into error_report Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: Append JSON description of migration streamAlexander Graf2015-02-051-6/+180
| | | | | | | | | | | | | | | | | | | | | | | | One of the annoyances of the current migration format is the fact that it's not self-describing. In fact, it's not properly describing at all. Some code randomly scattered throughout QEMU elaborates roughly how to read and write a stream of bytes. We discussed an idea during KVM Forum 2013 to add a JSON description of the migration protocol itself to the migration stream. This patch adds a section after the VM_END migration end marker that contains description data on what the device sections of the stream are composed of. This approach is backwards compatible with any QEMU version reading the stream, because QEMU just stops reading after the VM_END marker and ignores any data following it. With an additional external program this allows us to decipher the contents of any migration stream and hopefully make migration bugs easier to track down. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* qemu-file: Add fast ftell code pathAlexander Graf2015-02-051-0/+16
| | | | | | | | | | | | | | | | | | | | | For ftell we flush the output buffer to ensure that we don't have anything lingering in our internal buffers. This is a very safe thing to do. However, with the dynamic size measurement that the dynamic vmstate description will bring this would turn out quite slow. Instead, we can fast path this specific measurement and just take the internal buffers into account when telling the kernel our position. I'm sure I overlooked some corner cases where this doesn't work, so instead of tuning the safe, existing version, this patch adds a fast variant of ftell that gets used by the dynamic vmstate description code which isn't critical when it fails. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* Migration: Add lots of trace eventsDr. David Alan Gilbert2015-02-051-4/+20
| | | | | | | | | Mostly on the load side, so that when we get a complaint about a migration failure we can figure out what it didn't like. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* savevm: Convert fprintf to error_reportDr. David Alan Gilbert2015-02-051-3/+4
| | | | | | | | Convert a bunch of fprintfs to error_reports Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration_cancel: shutdown migration socketDr. David Alan Gilbert2015-01-161-0/+12
| | | | | | | | | | Force shutdown on migration socket on cancel to cause the cancel to complete even if the socket is blocked on a dead network. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* Handle bi-directional communication for fd migrationCristian Klein2015-01-161-2/+22
| | | | | | | | | | | | | | | | | | | | libvirt prefers opening the TCP connection itself, for two reasons. First, connection failed errors can be detected easier, without having to parse qemu's error output. Second, libvirt might be asked to secure the transfer by tunnelling the communication through an TLS layer. Therefore, libvirt opens the TCP connection itself and passes an FD to qemu using QMP and a POSIX-specific mechanism. Hence, in order to make the reverse-path work in such cases, qemu needs to distinguish if the transmitted FD is a socket (reverse-path available) or not (reverse-path might not be available) and use the corresponding abstraction. Signed-off-by: Cristian Klein <cristian.klein@cs.umu.se> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* socket shutdownDr. David Alan Gilbert2015-01-162-4/+31
| | | | | | | | | | Add QEMUFile interface to allow a socket to be 'shut down' - i.e. any reads/writes will fail (and any blocking read/write will be woken). Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* QEMUSizedBuffer: only free qsb that qemu_bufopen allocatedYang Hongyang2015-01-161-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only free qsb that qemu_bufopen allocated, and also allow qemu_bufopen accept qsb as input for write operation. It will make the API more logical: 1.If you create the QEMUSizedBuffer yourself, you need to free it by using qsb_free() but not depends on other API like qemu_fclose. 2.allow qemu_bufopen() accept QEMUSizedBuffer as input for write operation, otherwise, it will be a little strange for this API won't accept the second parameter. This brings API change, since there are only 3 users of this API currently, this change only impact the first one which will be fixed in patch 2 of this patchset, so I think it is safe to do this change. 1 70 tests/test-vmstate.c <<open_mem_file_read>> return qemu_bufopen("r", qsb); 2 404 tests/test-vmstate.c <<test_save_noskip>> QEMUFile *fsave = qemu_bufopen("w", NULL); 3 424 tests/test-vmstate.c <<test_save_skip>> QEMUFile *fsave = qemu_bufopen("w", NULL); Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Cc: Juan Quintela <quintela@redhat.com> Cc: Amit Shah <amit.shah@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* migration/qemu-file.c: Don't shift left into sign bitPeter Maydell2015-01-151-1/+1
| | | | | | | | Add a cast in qemu_get_be32() to avoid shifting left into the sign bit of a signed integer (which is undefined behaviour in C). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* migration/block: fix pending() return valueVladimir Sementsov-Ogievskiy2015-01-131-2/+2
| | | | | | | | | | | | | | | | | | | Because of wrong return value of .save_live_pending() in migration/block.c, migration finishes before the whole disk is transferred. Such situation occurs when the migration process is fast enough, for example when source and dest are on the same host. If in the bulk phase we return something < max_size, we will skip transferring the tail of the device. Currently we have "set pending to BLOCK_SIZE if it is zero" for bulk phase, but there no guarantee, that it will be < max_size. True approach is to return, for example, max_size+1 when we are in the bulk phase. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@parallels.com> Message-id: 1419933856-4018-2-git-send-email-vsementsov@parallels.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* block: fix spoiling all dirty bitmaps by mirror and migrationVladimir Sementsov-Ogievskiy2015-01-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Mirror and migration use dirty bitmaps for their purposes, and since commit [block: per caller dirty bitmap] they use their own bitmaps, not the global one. But they use old functions bdrv_set_dirty and bdrv_reset_dirty, which change all dirty bitmaps. Named dirty bitmaps series by Fam and Snow are affected: mirroring and migration will spoil all (not related to this mirroring or migration) named dirty bitmaps. This patch fixes this by adding bdrv_set_dirty_bitmap and bdrv_reset_dirty_bitmap, which change concrete bitmap. Also, to prevent such mistakes in future, old functions bdrv_(set,reset)_dirty are made static, for internal block usage. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@parallels.com> CC: John Snow <jsnow@redhat.com> CC: Fam Zheng <famz@redhat.com> CC: Denis V. Lunev <den@openvz.org> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1417081246-3593-1-git-send-email-vsementsov@parallels.com Signed-off-by: Max Reitz <mreitz@redhat.com>
* Split the QEMU buffered file code outDr. David Alan Gilbert2014-12-163-456/+487
| | | | | | | | The splitting of qemu-file and addition of the buffered file landed at the same time; so now split the buffered file code out. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* Split struct QEMUFile outDr. David Alan Gilbert2014-12-162-22/+54
| | | | | | | | | Now we've got multiple QEMUFile source files, some of them need access to things that were defined in qemu-file.c, so create a -internal header for them. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* Remove migration- pre/post fixes off files in migration/ dirDr. David Alan Gilbert2014-12-167-4/+4
| | | | | | | | The general feeling is that having migration/migration-blah is overkill. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* Start migrating migration code into a migration directoryDr. David Alan Gilbert2014-12-1613-0/+7657
The migration code now occupies a fair chunk of the top level .c files, it seems time to give it it's own directory. I've not touched: arch_init.c - that's mostly RAM migration but has a few random other bits savevm.c - because it's built target specific This is purely a code move; no code has changed. - it fails checkpatch because of old violations, it feels safer to keep this as purely a move and fix those at some mythical future date. The xbzrle and vmstate tests are now only run for softmmu builds since they require files in the migrate/ directory which is only built for softmmu. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
OpenPOWER on IntegriCloud