[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 7/8] migration-unix: side channel support on unix ou
From: |
Lei Li |
Subject: |
[Qemu-devel] [PATCH 7/8] migration-unix: side channel support on unix outgoing |
Date: |
Wed, 25 Sep 2013 22:32:47 +0800 |
This patch adds side channel support on the outgoing of unix
migration. It will create a pipe and pass the read pipe fd to
destination process by send_pipefd(). If the pipe fd was passed
successfully, the qemu_fopen_pipe will be called with write mode
to send RAM to the write pipe fd.
Signed-off-by: Lei Li <address@hidden>
---
migration-unix.c | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/migration-unix.c b/migration-unix.c
index 651fc5b..0bfc1c7 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -33,16 +33,44 @@
static void unix_wait_for_connect(int fd, void *opaque)
{
MigrationState *s = opaque;
+ int pipefd[2];
if (fd < 0) {
DPRINTF("migrate connect error\n");
- s->file = NULL;
- migrate_fd_error(s);
+ goto fail;
} else {
DPRINTF("migrate connect success\n");
- s->file = qemu_fopen_socket(fd, "wb");
+
+ if (s->enabled_capabilities[MIGRATION_CAPABILITY_UNIX_PAGE_FLIPPING]) {
+ if (pipe(pipefd) < 0) {
+ DPRINTF("qemu_fopen_pipe: %s", strerror(errno));
+ goto fail;
+ }
+
+ /* Send pipefd[0] to destination QEMU process */
+ if (send_pipefd(fd, pipefd[0]) < 0) {
+ DPRINTF("failed to pass pipe\n");
+ goto fail;
+ }
+
+ s->file = qemu_fopen_pipe(pipefd[1], "w");
+ } else {
+ s->file = qemu_fopen_socket(fd, "wb");
+ }
+
+ if (s->file == NULL) {
+ DPRINTF("failed to open migration target");
+ migrate_fd_error(s);
+ return;
+ }
+
migrate_fd_connect(s);
+ return;
}
+
+fail:
+ s->file = NULL;
+ migrate_fd_error(s);
}
void unix_start_outgoing_migration(MigrationState *s, const char *path, Error
**errp)
--
1.7.7.6
- [Qemu-devel] [PATCH 0/8 RFC] migration: Introduce side channel for RAM, Lei Li, 2013/09/25
- [Qemu-devel] [PATCH 1/8] migration-local: add pipe protocol for QEMUFileOps, Lei Li, 2013/09/25
- [Qemu-devel] [PATCH 3/8] migration-local: add send_pipefd(), Lei Li, 2013/09/25
- [Qemu-devel] [PATCH 5/8] QAPI: introduce magration capability unix_page_flipping, Lei Li, 2013/09/25
- [Qemu-devel] [PATCH 4/8] migration-local: add recv_pipefd(), Lei Li, 2013/09/25
- [Qemu-devel] [PATCH 6/8] migration: add migrate_unix_page_flipping(), Lei Li, 2013/09/25
- [Qemu-devel] [PATCH 7/8] migration-unix: side channel support on unix outgoing,
Lei Li <=
- [Qemu-devel] [PATCH 8/8] migration-unix: side channel support on unix incoming, Lei Li, 2013/09/25
- [Qemu-devel] [PATCH 2/8] migration-loca: add qemu_fopen_pipe(), Lei Li, 2013/09/25
- Re: [Qemu-devel] [PATCH 0/8 RFC] migration: Introduce side channel for RAM, Paolo Bonzini, 2013/09/25