[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/17] migration-local: override before_ram_iterate
From: |
Lei Li |
Subject: |
[Qemu-devel] [PATCH 07/17] migration-local: override before_ram_iterate to send pipefd |
Date: |
Thu, 21 Nov 2013 17:11:30 +0800 |
Override before_ram_iterate to send pipefd. It will qemu_fflush
the stream QEMUFile and send it in RAM_CONTROL_SETUP stage.
Signed-off-by: Lei Li <address@hidden>
---
migration-local.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/migration-local.c b/migration-local.c
index f4265a1..e028beb 100644
--- a/migration-local.c
+++ b/migration-local.c
@@ -114,6 +114,30 @@ static int qemu_local_close(void *opaque)
return 0;
}
+static int send_pipefd(int sockfd, int pipefd);
+
+static int qemu_local_send_pipefd(QEMUFile *f, void *opaque,
+ uint64_t flags)
+{
+ QEMUFileLocal *s = opaque;
+ int ret;
+
+ if (s->unix_page_flipping) {
+ /* Avoid sending pipe fd again in ram_save_complete() stage */
+ if (flags == RAM_CONTROL_SETUP) {
+ qemu_fflush(f);
+ ret = send_pipefd(s->sockfd, s->pipefd[0]);
+ if (ret < 0) {
+ fprintf(stderr, "failed to pass PIPE\n");
+ return ret;
+ }
+ DPRINTF("PIPE fd was sent\n");
+ }
+ }
+
+ return 0;
+}
+
static const QEMUFileOps pipe_read_ops = {
.get_fd = qemu_local_get_sockfd,
.get_buffer = qemu_local_get_buffer,
@@ -124,6 +148,7 @@ static const QEMUFileOps pipe_write_ops = {
.get_fd = qemu_local_get_sockfd,
.writev_buffer = qemu_local_writev_buffer,
.close = qemu_local_close,
+ .before_ram_iterate = qemu_local_send_pipefd,
};
QEMUFile *qemu_fopen_socket_local(int sockfd, const char *mode)
--
1.7.7.6
- [Qemu-devel] [PATCH 0/17 v3] Localhost migration with side channel for ram, Lei Li, 2013/11/21
- [Qemu-devel] [PATCH 02/17] migration: add migrate_unix_page_flipping(), Lei Li, 2013/11/21
- [Qemu-devel] [PATCH 03/17] qmp-command.hx: add missing docs for migration capabilites, Lei Li, 2013/11/21
- [Qemu-devel] [PATCH 01/17] QAPI: introduce migration capability unix_page_flipping, Lei Li, 2013/11/21
- [Qemu-devel] [PATCH 04/17] migration-local: add QEMUFileLocal with socket based QEMUFile, Lei Li, 2013/11/21
- [Qemu-devel] [PATCH 05/17] migration-local: introduce qemu_fopen_socket_local(), Lei Li, 2013/11/21
- [Qemu-devel] [PATCH 06/17] migration-local: add send_pipefd(), Lei Li, 2013/11/21
- [Qemu-devel] [PATCH 07/17] migration-local: override before_ram_iterate to send pipefd,
Lei Li <=
- [Qemu-devel] [PATCH 08/17] add unix_msgfd_lookup() to callback get_buffer, Lei Li, 2013/11/21
- [Qemu-devel] [PATCH 10/17] migration-local: override save_page for page transmit, Lei Li, 2013/11/21
- [Qemu-devel] [PATCH 11/17] savevm: adjust ram_control_save_page for page flipping, Lei Li, 2013/11/21
- [Qemu-devel] [PATCH 12/17] migration-local: override hook_ram_load, Lei Li, 2013/11/21