From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj59W-0001cp-GM for qemu-devel@nongnu.org; Thu, 24 Mar 2016 09:18:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aj59V-00056L-Fv for qemu-devel@nongnu.org; Thu, 24 Mar 2016 09:18:18 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj59V-00056E-9B for qemu-devel@nongnu.org; Thu, 24 Mar 2016 09:18:17 -0400 Received: by mail-wm0-x241.google.com with SMTP id s187so2613909wme.2 for ; Thu, 24 Mar 2016 06:18:17 -0700 (PDT) From: Baptiste Reynal Date: Thu, 24 Mar 2016 14:16:41 +0100 Message-Id: <1458825402-9592-4-git-send-email-b.reynal@virtualopensystems.com> In-Reply-To: <1458825402-9592-1-git-send-email-b.reynal@virtualopensystems.com> References: <1458825402-9592-1-git-send-email-b.reynal@virtualopensystems.com> Subject: [Qemu-devel] [RFC 3/4] migration: extend shared migration type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: b.reynal@virtualopensystems.com, Juan Quintela , Claudio.Fontana@huawei.com, Amit Shah , pbonzini@redhat.com, Jani.Kokkonen@huawei.com, tech@virtualopensystems.com shared migration now supports shared or network memory. Signed-off-by: Baptiste Reynal --- 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