qemu/migration
Daniel Henrique Barboza acab30b85d migration/ram.c: do not set 'postcopy_running' in POSTCOPY_INCOMING_END
When migrating a VM with 'migrate_set_capability postcopy-ram on'
a postcopy_state is set during the process, ending up with the
state POSTCOPY_INCOMING_END when the migration is over. This
postcopy_state is taken into account inside ram_load to check
how it will load the memory pages. This same ram_load is called when
in a loadvm command.

Inside ram_load, the logic to see if we're at postcopy_running state
is:

postcopy_running = postcopy_state_get() >= POSTCOPY_INCOMING_LISTENING

postcopy_state_get() returns this enum type:

typedef enum {
    POSTCOPY_INCOMING_NONE = 0,
    POSTCOPY_INCOMING_ADVISE,
    POSTCOPY_INCOMING_DISCARD,
    POSTCOPY_INCOMING_LISTENING,
    POSTCOPY_INCOMING_RUNNING,
    POSTCOPY_INCOMING_END
} PostcopyState;

In the case where ram_load is executed and postcopy_state is
POSTCOPY_INCOMING_END, postcopy_running will be set to 'true' and
ram_load will behave like a postcopy is in progress. This scenario isn't
achievable in a migration but it is reproducible when executing
savevm/loadvm after migrating with 'postcopy-ram on', causing loadvm
to fail with Error -22:

Source:

(qemu) migrate_set_capability postcopy-ram on
(qemu) migrate tcp:127.0.0.1:4444

Dest:

(qemu) migrate_set_capability postcopy-ram on
(qemu)
ubuntu1704-intel login:
Ubuntu 17.04 ubuntu1704-intel ttyS0

ubuntu1704-intel login: (qemu)
(qemu) savevm test1
(qemu) loadvm test1
Unknown combination of migration flags: 0x4 (postcopy mode)
error while loading state for instance 0x0 of device 'ram'
Error -22 while loading VM state
(qemu)

This patch fixes this problem by changing the existing logic for
postcopy_advised and postcopy_running in ram_load, making them
'false' if we're at POSTCOPY_INCOMING_END state.

Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
CC: Juan Quintela <quintela@redhat.com>
CC: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2017-11-22 08:50:37 +01:00
..
block.c block: Make bdrv_next() keep strong references 2017-11-17 18:21:31 +01:00
block.h
channel.c
channel.h
colo-comm.c
colo-failover.c
colo.c
exec.c
exec.h
fd.c
fd.h
global_state.c
Makefile.objs
migration.c migration: Make xbzrle_cache_size a migration parameter 2017-10-29 14:06:15 +01:00
migration.h migration: Make xbzrle_cache_size a migration parameter 2017-10-29 14:06:15 +01:00
page_cache.c migration: Make sure that we pass the right cache size 2017-10-29 14:06:15 +01:00
page_cache.h
postcopy-ram.c migration: add bitmap for received page 2017-10-23 18:03:41 +02:00
postcopy-ram.h migration: postcopy_place_page factoring out 2017-10-23 18:03:39 +02:00
qemu-file-channel.c
qemu-file-channel.h
qemu-file.c
qemu-file.h
qjson.c
qjson.h
ram.c migration/ram.c: do not set 'postcopy_running' in POSTCOPY_INCOMING_END 2017-11-22 08:50:37 +01:00
ram.h migration: No need to return the size of the cache 2017-10-29 14:06:15 +01:00
rdma.c
rdma.h
savevm.c migration, xen: Fix block image lock issue on live migration 2017-11-21 19:42:26 +01:00
savevm.h
socket.c
socket.h
tls.c migration: Improve migration thread error handling 2017-10-23 18:03:43 +02:00
tls.h
trace-events
vmstate-types.c
vmstate.c
xbzrle.c
xbzrle.h