migration/next for 20171122

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJaFTihAAoJEPSH7xhYctcj12AQAIFdsnLzOl5GlBOKgakwF3is
 09sHP0bV1S/1b8mW2z/Axrkj02qyUmXKXcl4vqwbSf6cYzwdXNhzWYCcXy+OBtQ2
 sQCYP83CjzFW6m79UJZZ3iHxJvoxduaH490XzLs25EwnHOPLIgdmkeEeQLLk1N3a
 yncZu65Psf+LqEx3BeWUYgUaFACszxZ7cv/IE68VLvk9V7xKFSDioo69DZHrKqE/
 Ov9D34/GMKf450jKdH0V4vFjz/8QT4+PJpcCnRmVelIDRGLDteolTXMb6hVLXz/O
 q8VrWFzHbqu4TDS8jvL1oxSXKK1f8VVOSnvUVIIcsnXvfsyfistjxoEUfVUCP+h3
 e95fFFYlYUrKgY3JVhSXx09b5VglsyF8VEHaW5HnJOQyDAxDi0FJHTWVF5g3/7ZQ
 1JY+KCU1WuPslTQiDfbS48EZ3brPPIJAWszFWa/L9yufQo6lUX3WZrqrIGbkxb70
 zDi60lXUJh8kD63Fn0tBT0pDMG/5kEjwruIt8pNb5dFBa5xHl9ZF2PowtLtokTBj
 9PTe23cuzksWqRn1oqEHSy0IuX1/IHNvEndIJrOo8GR4BWCPnHsWNKy9asahGJN9
 gcVLkmPKzjCfr8MeRogLJmDwYTVJvBocgPRBuTllHw77jJZM0ZN/RhVUtTXFxkNs
 GtL5tPSjTB5eUJmLFCnY
 =fmeh
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20171122' into staging

migration/next for 20171122

# gpg: Signature made Wed 22 Nov 2017 08:43:13 GMT
# gpg:                using RSA key 0xF487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* remotes/juanquintela/tags/migration/20171122:
  migration/ram.c: do not set 'postcopy_running' in POSTCOPY_INCOMING_END
  migration, xen: Fix block image lock issue on live migration

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-11-23 13:50:00 +00:00
commit 54c85bebb5
3 changed files with 41 additions and 4 deletions

View File

@ -2798,6 +2798,18 @@ static int ram_load_postcopy(QEMUFile *f)
return ret;
}
static bool postcopy_is_advised(void)
{
PostcopyState ps = postcopy_state_get();
return ps >= POSTCOPY_INCOMING_ADVISE && ps < POSTCOPY_INCOMING_END;
}
static bool postcopy_is_running(void)
{
PostcopyState ps = postcopy_state_get();
return ps >= POSTCOPY_INCOMING_LISTENING && ps < POSTCOPY_INCOMING_END;
}
static int ram_load(QEMUFile *f, void *opaque, int version_id)
{
int flags = 0, ret = 0, invalid_flags = 0;
@ -2807,9 +2819,9 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
* If system is running in postcopy mode, page inserts to host memory must
* be atomic
*/
bool postcopy_running = postcopy_state_get() >= POSTCOPY_INCOMING_LISTENING;
bool postcopy_running = postcopy_is_running();
/* ADVISE is earlier, it shows the source has the postcopy capability on */
bool postcopy_advised = postcopy_state_get() >= POSTCOPY_INCOMING_ADVISE;
bool postcopy_advised = postcopy_is_advised();
seq_iter++;

View File

@ -2242,13 +2242,20 @@ int save_snapshot(const char *name, Error **errp)
return ret;
}
void qmp_xen_save_devices_state(const char *filename, Error **errp)
void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
Error **errp)
{
QEMUFile *f;
QIOChannelFile *ioc;
int saved_vm_running;
int ret;
if (!has_live) {
/* live default to true so old version of Xen tool stack can have a
* successfull live migration */
live = true;
}
saved_vm_running = runstate_is_running();
vm_stop(RUN_STATE_SAVE_VM);
global_state_store_running();
@ -2263,6 +2270,20 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp)
qemu_fclose(f);
if (ret < 0) {
error_setg(errp, QERR_IO_ERROR);
} else {
/* libxl calls the QMP command "stop" before calling
* "xen-save-devices-state" and in case of migration failure, libxl
* would call "cont".
* So call bdrv_inactivate_all (release locks) here to let the other
* side of the migration take controle of the images.
*/
if (live && !saved_vm_running) {
ret = bdrv_inactivate_all();
if (ret) {
error_setg(errp, "%s: bdrv_inactivate_all() failed (%d)",
__func__, ret);
}
}
}
the_end:

View File

@ -1075,6 +1075,9 @@
# data. See xen-save-devices-state.txt for a description of the binary
# format.
#
# @live: Optional argument to ask QEMU to treat this command as part of a live
# migration. Default to true. (since 2.11)
#
# Returns: Nothing on success
#
# Since: 1.1
@ -1086,7 +1089,8 @@
# <- { "return": {} }
#
##
{ 'command': 'xen-save-devices-state', 'data': {'filename': 'str'} }
{ 'command': 'xen-save-devices-state',
'data': {'filename': 'str', '*live':'bool' } }
##
# @xen-set-replication: