shared migration now supports shared or network memory. Signed-off-by: Baptiste Reynal <b.rey...@virtualopensystems.com> --- migration/shared.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/migration/shared.c b/migration/shared.c index 1371a71..eb13eb9 100644 --- a/migration/shared.c +++ b/migration/shared.c @@ -6,6 +6,7 @@ #include "migration/qemu-file.h" #include "block/block.h" #include "sysemu/hostmem-shared.h" +#include "sysemu/hostmem-network.h" static void shared_accept_incoming_migration(void *opaque) { @@ -18,16 +19,29 @@ static void shared_accept_incoming_migration(void *opaque) void shared_start_incoming_migration(const char *id, Error **errp) { + HostMemoryBackendNetwork *shmn; HostMemoryBackendShared *shm = (HostMemoryBackendShared *) object_resolve_path_type(id, TYPE_MEMORY_BACKEND_SHARED, NULL); QEMUFile *f; + int event = 0; - if (shm == NULL) { + if (!shm) { + shmn = (HostMemoryBackendNetwork *) object_resolve_path_type(id, + TYPE_MEMORY_BACKEND_NETWORK, NULL); + + if (shmn) { + event = shmn->event; + } + } else { + event = shm->event; + } + + if (!event) { printf("Error: Cannot find shared memory %s\n", id); exit(-1); } - f = qemu_fdopen(shm->event, "rb"); + f = qemu_fdopen(event, "rb"); - qemu_set_fd_handler(shm->event, shared_accept_incoming_migration, NULL, f); + qemu_set_fd_handler(event, shared_accept_incoming_migration, NULL, f); } -- 2.7.4