]> git.proxmox.com Git - mirror_qemu.git/commit
migration: better error handling with QEMUFile
authorPeter Xu <peterx@redhat.com>
Thu, 8 Feb 2018 10:31:05 +0000 (18:31 +0800)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Wed, 14 Feb 2018 10:34:56 +0000 (10:34 +0000)
commit7a9ddfbfae4aaf8a7e4dafb57ac9fecad807a6b7
tree1a678f726395f20f2bda3e9018efa1e15a4b365a
parent2c9bb29703caa8fd31078cc38b3b53762557c27c
migration: better error handling with QEMUFile

If the postcopy down due to some reason, we can always see this on dst:

  qemu-system-x86_64: RP: Received invalid message 0x0000 length 0x0000

However in most cases that's not the real issue. The problem is that
qemu_get_be16() has no way to show whether the returned data is valid or
not, and we are _always_ assuming it is valid. That's possibly not wise.

The best approach to solve this would be: refactoring QEMUFile interface
to allow the APIs to return error if there is. However it needs quite a
bit of work and testing. For now, let's explicitly check the validity
first before using the data in all places for qemu_get_*().

This patch tries to fix most of the cases I can see. Only if we are with
this, can we make sure we are processing the valid data, and also can we
make sure we can capture the channel down events correctly.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180208103132.28452-2-peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
migration/migration.c
migration/ram.c
migration/savevm.c