From fde932816e27cf4c343d07d1b481d70a4e91f5e5 Mon Sep 17 00:00:00 2001 From: "Huawei Technologies Co., Ltd" Date: Wed, 2 Dec 2020 11:25:44 +0800 Subject: [PATCH] migration/tls: add tls_hostname into MultiFDSendParams MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since multifd creation is async with migration_channel_connect, we should pass the hostname from MigrationState to MultiFDSendParams. Signed-off-by: Chuan Zheng Signed-off-by: Yan Jin Message-Id: <1600139042-104593-4-git-send-email-zhengchuan@huawei.com> Reviewed-by: Daniel P. Berrangé Signed-off-by: Dr. David Alan Gilbert --- ...d-tls_hostname-into-MultiFDSendParam.patch | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 migration-tls-add-tls_hostname-into-MultiFDSendParam.patch diff --git a/migration-tls-add-tls_hostname-into-MultiFDSendParam.patch b/migration-tls-add-tls_hostname-into-MultiFDSendParam.patch new file mode 100644 index 0000000..3b06a42 --- /dev/null +++ b/migration-tls-add-tls_hostname-into-MultiFDSendParam.patch @@ -0,0 +1,66 @@ +From 0aff29297923b32e919ce944030a043e0826d9aa Mon Sep 17 00:00:00 2001 +From: Ying Fang +Date: Wed, 2 Dec 2020 11:25:44 +0800 +Subject: [PATCH] migration/tls: add tls_hostname into MultiFDSendParams +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since multifd creation is async with migration_channel_connect, we should +pass the hostname from MigrationState to MultiFDSendParams. + +Signed-off-by: Chuan Zheng +Signed-off-by: Yan Jin +Message-Id: <1600139042-104593-4-git-send-email-zhengchuan@huawei.com> +Reviewed-by: Daniel P. Berrangé +Signed-off-by: Dr. David Alan Gilbert +--- + migration/ram.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/migration/ram.c b/migration/ram.c +index 1a33c7b3e2..bb8f383c3b 100644 +--- a/migration/ram.c ++++ b/migration/ram.c +@@ -621,6 +621,8 @@ typedef struct { + uint8_t id; + /* channel thread name */ + char *name; ++ /* tls hostname */ ++ char *tls_hostname; + /* channel thread id */ + QemuThread thread; + /* communication channel */ +@@ -1041,6 +1043,8 @@ void multifd_save_cleanup(void) + qemu_sem_destroy(&p->sem_sync); + g_free(p->name); + p->name = NULL; ++ g_free(p->tls_hostname); ++ p->tls_hostname = NULL; + multifd_pages_clear(p->pages); + p->pages = NULL; + p->packet_len = 0; +@@ -1229,10 +1233,12 @@ int multifd_save_setup(void) + int thread_count; + uint32_t page_count = MULTIFD_PACKET_SIZE / qemu_target_page_size(); + uint8_t i; ++ MigrationState *s; + + if (!migrate_use_multifd()) { + return 0; + } ++ s = migrate_get_current(); + thread_count = migrate_multifd_channels(); + multifd_send_state = g_malloc0(sizeof(*multifd_send_state)); + multifd_send_state->params = g_new0(MultiFDSendParams, thread_count); +@@ -1253,6 +1259,7 @@ int multifd_save_setup(void) + + sizeof(ram_addr_t) * page_count; + p->packet = g_malloc0(p->packet_len); + p->name = g_strdup_printf("multifdsend_%d", i); ++ p->tls_hostname = g_strdup(s->hostname); + socket_send_channel_create(multifd_new_send_channel_async, p); + } + return 0; +-- +2.27.0 +