[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/26] migration/tls: extract migration_tls_client_create for comm
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 18/26] migration/tls: extract migration_tls_client_create for common-use |
Date: |
Fri, 25 Sep 2020 13:06:47 +0100 |
From: Chuan Zheng <zhengchuan@huawei.com>
migration_tls_client_create will be used in multifd-tls, let's
extract it.
Signed-off-by: Chuan Zheng <zhengchuan@huawei.com>
Signed-off-by: Yan Jin <jinyan12@huawei.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <1600139042-104593-3-git-send-email-zhengchuan@huawei.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/tls.c | 26 ++++++++++++++++++--------
migration/tls.h | 6 ++++++
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/migration/tls.c b/migration/tls.c
index 8fbf9ac796..66c6f43221 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -22,7 +22,6 @@
#include "channel.h"
#include "migration.h"
#include "tls.h"
-#include "io/channel-tls.h"
#include "crypto/tlscreds.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
@@ -125,11 +124,10 @@ static void migration_tls_outgoing_handshake(QIOTask
*task,
object_unref(OBJECT(ioc));
}
-
-void migration_tls_channel_connect(MigrationState *s,
- QIOChannel *ioc,
- const char *hostname,
- Error **errp)
+QIOChannelTLS *migration_tls_client_create(MigrationState *s,
+ QIOChannel *ioc,
+ const char *hostname,
+ Error **errp)
{
QCryptoTLSCreds *creds;
QIOChannelTLS *tioc;
@@ -137,7 +135,7 @@ void migration_tls_channel_connect(MigrationState *s,
creds = migration_tls_get_creds(
s, QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, errp);
if (!creds) {
- return;
+ return NULL;
}
if (s->parameters.tls_hostname && *s->parameters.tls_hostname) {
@@ -145,11 +143,23 @@ void migration_tls_channel_connect(MigrationState *s,
}
if (!hostname) {
error_setg(errp, "No hostname available for TLS");
- return;
+ return NULL;
}
tioc = qio_channel_tls_new_client(
ioc, creds, hostname, errp);
+
+ return tioc;
+}
+
+void migration_tls_channel_connect(MigrationState *s,
+ QIOChannel *ioc,
+ const char *hostname,
+ Error **errp)
+{
+ QIOChannelTLS *tioc;
+
+ tioc = migration_tls_client_create(s, ioc, hostname, errp);
if (!tioc) {
return;
}
diff --git a/migration/tls.h b/migration/tls.h
index cdd70001ed..0cfbe368ba 100644
--- a/migration/tls.h
+++ b/migration/tls.h
@@ -22,11 +22,17 @@
#define QEMU_MIGRATION_TLS_H
#include "io/channel.h"
+#include "io/channel-tls.h"
void migration_tls_channel_process_incoming(MigrationState *s,
QIOChannel *ioc,
Error **errp);
+QIOChannelTLS *migration_tls_client_create(MigrationState *s,
+ QIOChannel *ioc,
+ const char *hostname,
+ Error **errp);
+
void migration_tls_channel_connect(MigrationState *s,
QIOChannel *ioc,
const char *hostname,
--
2.26.2
- [PULL 08/26] migration/dirtyrate: Record hash results for each sampled page, (continued)
- [PULL 08/26] migration/dirtyrate: Record hash results for each sampled page, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 09/26] migration/dirtyrate: Compare page hash results for recorded sampled page, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 10/26] migration/dirtyrate: skip sampling ramblock with size below MIN_RAMBLOCK_SIZE, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 11/26] migration/dirtyrate: Implement set_sample_page_period() and is_sample_period_valid(), Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 12/26] migration/dirtyrate: Implement calculate_dirtyrate() function, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 13/26] migration/dirtyrate: Implement qmp_cal_dirty_rate()/qmp_get_dirty_rate() function, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 14/26] migration/dirtyrate: Add trace_calls to make it easier to debug, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 15/26] migration: Truncate state file in xen-save-devices-state, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 16/26] migration: increase max-bandwidth to 128 MiB/s (1 Gib/s), Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 17/26] migration/tls: save hostname into MigrationState, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 18/26] migration/tls: extract migration_tls_client_create for common-use,
Dr. David Alan Gilbert (git) <=
- [PULL 19/26] migration/tls: add tls_hostname into MultiFDSendParams, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 20/26] migration/tls: extract cleanup function for common-use, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 21/26] migration/tls: add support for multifd tls-handshake, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 22/26] migration/tls: add trace points for multifd-tls, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 24/26] virtiofsd: document cache=auto default, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 25/26] virtiofsd: Used glib "shared" thread pool, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 26/26] virtiofsd: Add -o allow_direct_io|no_allow_direct_io options, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 23/26] monitor: Use LOCK_GUARD macros, Dr. David Alan Gilbert (git), 2020/09/25