From e110aa919a84e6454017b60b222344f3ac6038b5 Mon Sep 17 00:00:00 2001 From: Cao jin Date: Fri, 29 Jul 2016 15:10:31 +0800 Subject: [PATCH 1/4] migration/ram: fix typo Signed-off-by: Cao jin Message-Id: <1469776231-23820-1-git-send-email-caoj.fnst@cn.fujitsu.com> Signed-off-by: Amit Shah --- migration/ram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 815bc0e11a..a3d70c4c62 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -375,8 +375,8 @@ void migrate_compress_threads_create(void) qemu_cond_init(&comp_done_cond); qemu_mutex_init(&comp_done_lock); for (i = 0; i < thread_count; i++) { - /* com_param[i].file is just used as a dummy buffer to save data, set - * it's ops to empty. + /* comp_param[i].file is just used as a dummy buffer to save data, + * set its ops to empty. */ comp_param[i].file = qemu_fopen_ops(NULL, &empty_ops); comp_param[i].done = true; From 0e8b3cdfbc167f4bb7790ef744eaa1ac0e6959f9 Mon Sep 17 00:00:00 2001 From: Evgeny Yakovlev Date: Fri, 29 Jul 2016 12:48:25 +0300 Subject: [PATCH 2/4] migration: mmap error check fix mmap man page: "On success, mmap() returns a pointer to the mapped area. On error, the value MAP_FAILED (that is, (void *) -1) is returned, and errno is set to indicate the cause of the error." The check in postcopy_get_tmp_page is definitely wrong and should be fixed. Signed-off-by: Evgeny Yakovlev Signed-off-by: Denis V. Lunev Reviewed-by: Amit Shah Reviewed-by: Dr. David Alan Gilbert CC: Juan Quintela CC: Amit Shah Message-Id: <1469785705-16670-1-git-send-email-den@openvz.org> Signed-off-by: Amit Shah --- migration/postcopy-ram.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index abe8c60a90..9b0477835f 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -604,7 +604,8 @@ void *postcopy_get_tmp_page(MigrationIncomingState *mis) mis->postcopy_tmp_page = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (!mis->postcopy_tmp_page) { + if (mis->postcopy_tmp_page == MAP_FAILED) { + mis->postcopy_tmp_page = NULL; error_report("%s: %s", __func__, strerror(errno)); return NULL; } From 787d134fb164e0395685744ef75829c15f5aee8d Mon Sep 17 00:00:00 2001 From: Liang Li Date: Tue, 9 Aug 2016 08:22:26 +0800 Subject: [PATCH 3/4] migration: fix live migration failure with compression Because of commit 11808bb0c422, which remove some condition checks of 'f->ops->writev_buffer', 'qemu_put_qemu_file' should be enhanced to clear the 'f_src->iovcnt', or 'f_src->iovcnt' may exceed the MAX_IOV_SIZE which will break live migration. This should be fixed. Signed-off-by: Liang Li Reported-by: Jinshi Zhang Reviewed-by: Dr. David Alan Gilbert Message-Id: <1470702146-24399-1-git-send-email-liang.z.li@intel.com> Signed-off-by: Amit Shah --- migration/qemu-file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index bbc565eb53..e9fae31158 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -668,6 +668,7 @@ int qemu_put_qemu_file(QEMUFile *f_des, QEMUFile *f_src) len = f_src->buf_index; qemu_put_buffer(f_des, f_src->buf, f_src->buf_index); f_src->buf_index = 0; + f_src->iovcnt = 0; } return len; } From 474c624ddf0d390b850526a01026ef8737e67ca7 Mon Sep 17 00:00:00 2001 From: Cao jin Date: Thu, 28 Jul 2016 16:54:34 +0800 Subject: [PATCH 4/4] migration/socket: fix typo in file header Code of inet socket & unix socket is merged together. Also add some newlines, make code block well separated. Cc: Daniel P. Berrange Cc: Juan Quintela Cc: Amit Shah Reviewed-by: Daniel P. Berrange Signed-off-by: Cao jin Message-Id: <1469696074-12744-4-git-send-email-caoj.fnst@cn.fujitsu.com> Signed-off-by: Amit Shah --- migration/socket.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/socket.c b/migration/socket.c index 5c0a38f7b9..00de1fe127 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -1,5 +1,5 @@ /* - * QEMU live migration via Unix Domain Sockets + * QEMU live migration via socket * * Copyright Red Hat, Inc. 2009-2016 * @@ -94,10 +94,12 @@ static void socket_start_outgoing_migration(MigrationState *s, { QIOChannelSocket *sioc = qio_channel_socket_new(); struct SocketConnectData *data = g_new0(struct SocketConnectData, 1); + data->s = s; if (saddr->type == SOCKET_ADDRESS_KIND_INET) { data->hostname = g_strdup(saddr->u.inet.data->host); } + qio_channel_socket_connect_async(sioc, saddr, socket_outgoing_migration,