qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Baptiste Reynal <b.reynal@virtualopensystems.com>
To: qemu-devel@nongnu.org
Cc: b.reynal@virtualopensystems.com,
	Juan Quintela <quintela@redhat.com>,
	Claudio.Fontana@huawei.com, Amit Shah <amit.shah@redhat.com>,
	pbonzini@redhat.com, Jani.Kokkonen@huawei.com,
	tech@virtualopensystems.com
Subject: [Qemu-devel] [RFC 3/4] migration: extend shared migration type
Date: Thu, 24 Mar 2016 14:16:41 +0100	[thread overview]
Message-ID: <1458825402-9592-4-git-send-email-b.reynal@virtualopensystems.com> (raw)
In-Reply-To: <1458825402-9592-1-git-send-email-b.reynal@virtualopensystems.com>

shared migration now supports shared or network memory.

Signed-off-by: Baptiste Reynal <b.reynal@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

  parent reply	other threads:[~2016-03-24 13:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 13:16 [Qemu-devel] [RFC 0/4] QEMU shared-memory over network Baptiste Reynal
2016-03-24 13:16 ` [Qemu-devel] [RFC 1/4] backend: multi-client-socket Baptiste Reynal
2016-03-24 13:16 ` [Qemu-devel] [RFC 2/4] backend: shared memory over network backend Baptiste Reynal
2016-03-24 13:16 ` Baptiste Reynal [this message]
2016-03-24 13:16 ` [Qemu-devel] [RFC 4/4] hw/misc: sdm signal nboot Baptiste Reynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458825402-9592-4-git-send-email-b.reynal@virtualopensystems.com \
    --to=b.reynal@virtualopensystems.com \
    --cc=Claudio.Fontana@huawei.com \
    --cc=Jani.Kokkonen@huawei.com \
    --cc=amit.shah@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=tech@virtualopensystems.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).