From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com,
leobras@redhat.com, berrange@redhat.com
Subject: [PULL 13/16] migration: Add migrate_use_tls() helper
Date: Mon, 9 May 2022 16:02:50 +0100 [thread overview]
Message-ID: <20220509150253.218715-14-dgilbert@redhat.com> (raw)
In-Reply-To: <20220509150253.218715-1-dgilbert@redhat.com>
From: Leonardo Bras <leobras@redhat.com>
A lot of places check parameters.tls_creds in order to evaluate if TLS is
in use, and sometimes call migrate_get_current() just for that test.
Add new helper function migrate_use_tls() in order to simplify testing
for TLS usage.
Signed-off-by: Leonardo Bras <leobras@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220507015759.840466-5-leobras@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/channel.c | 3 +--
migration/migration.c | 9 +++++++++
migration/migration.h | 1 +
migration/multifd.c | 5 +----
4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/migration/channel.c b/migration/channel.c
index c6a8dcf1d7..a162d00fea 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -38,8 +38,7 @@ void migration_channel_process_incoming(QIOChannel *ioc)
trace_migration_set_incoming_channel(
ioc, object_get_typename(OBJECT(ioc)));
- if (s->parameters.tls_creds &&
- *s->parameters.tls_creds &&
+ if (migrate_use_tls() &&
!object_dynamic_cast(OBJECT(ioc),
TYPE_QIO_CHANNEL_TLS)) {
migration_tls_channel_process_incoming(s, ioc, &local_err);
diff --git a/migration/migration.c b/migration/migration.c
index 3e91f4b5e2..4b6df2eb5e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2588,6 +2588,15 @@ bool migrate_use_zero_copy_send(void)
}
#endif
+int migrate_use_tls(void)
+{
+ MigrationState *s;
+
+ s = migrate_get_current();
+
+ return s->parameters.tls_creds && *s->parameters.tls_creds;
+}
+
int migrate_use_xbzrle(void)
{
MigrationState *s;
diff --git a/migration/migration.h b/migration/migration.h
index e8f2941a55..485d58b95f 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -380,6 +380,7 @@ bool migrate_use_zero_copy_send(void);
#else
#define migrate_use_zero_copy_send() (false)
#endif
+int migrate_use_tls(void);
int migrate_use_xbzrle(void);
uint64_t migrate_xbzrle_cache_size(void);
bool migrate_colo_enabled(void);
diff --git a/migration/multifd.c b/migration/multifd.c
index 9ea4f581e2..2a8c8570c3 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -782,15 +782,12 @@ static bool multifd_channel_connect(MultiFDSendParams *p,
QIOChannel *ioc,
Error *error)
{
- MigrationState *s = migrate_get_current();
-
trace_multifd_set_outgoing_channel(
ioc, object_get_typename(OBJECT(ioc)),
migrate_get_current()->hostname, error);
if (!error) {
- if (s->parameters.tls_creds &&
- *s->parameters.tls_creds &&
+ if (migrate_use_tls() &&
!object_dynamic_cast(OBJECT(ioc),
TYPE_QIO_CHANNEL_TLS)) {
multifd_tls_channel_connect(p, ioc, &error);
--
2.36.0
next prev parent reply other threads:[~2022-05-09 15:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-09 15:02 [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 01/16] tests: fix encoding of IP addresses in x509 certs Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 02/16] tests: add more helper macros for creating TLS " Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 03/16] tests: add migration tests of TLS with PSK credentials Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 04/16] tests: add migration tests of TLS with x509 credentials Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 05/16] tests: convert XBZRLE migration test to use common helper Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 06/16] tests: convert multifd migration tests " Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 07/16] tests: add multifd migration tests of TLS with PSK credentials Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 08/16] tests: add multifd migration tests of TLS with x509 credentials Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 09/16] tests: ensure migration status isn't reported as failed Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 10/16] QIOChannel: Add flags on io_writev and introduce io_flush callback Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 11/16] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 12/16] migration: Add zero-copy-send parameter for QMP/HMP for Linux Dr. David Alan Gilbert (git)
2022-05-09 19:45 ` Richard Henderson
2022-05-09 21:01 ` Leonardo Bras Soares Passos
2022-05-10 8:04 ` Dr. David Alan Gilbert
2022-05-09 15:02 ` Dr. David Alan Gilbert (git) [this message]
2022-05-09 15:02 ` [PULL 14/16] multifd: multifd_send_sync_main now returns negative on error Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 15/16] multifd: Send header packet without flags if zero-copy-send is enabled Dr. David Alan Gilbert (git)
2022-05-09 15:02 ` [PULL 16/16] multifd: Implement zero copy write in multifd migration (multifd-zero-copy) Dr. David Alan Gilbert (git)
-- strict thread matches above, loose matches on Subject: below --
2022-05-10 8:33 [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
2022-05-10 8:33 ` [PULL 13/16] migration: Add migrate_use_tls() helper Dr. David Alan Gilbert (git)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220509150253.218715-14-dgilbert@redhat.com \
--to=dgilbert@redhat.com \
--cc=berrange@redhat.com \
--cc=leobras@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).