migration: Create migrate_tls_hostname() function
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
Moved the type to const char * (vladimir)
diff --git a/migration/options.c b/migration/options.c
index 014aecc..1aa9575 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -596,6 +596,13 @@
return s->parameters.tls_creds;
}
+const char *migrate_tls_hostname(void)
+{
+ MigrationState *s = migrate_get_current();
+
+ return s->parameters.tls_hostname;
+}
+
uint64_t migrate_xbzrle_cache_size(void)
{
MigrationState *s = migrate_get_current();
diff --git a/migration/options.h b/migration/options.h
index 987e639..819c1b1 100644
--- a/migration/options.h
+++ b/migration/options.h
@@ -82,6 +82,7 @@
uint8_t migrate_throttle_trigger_threshold(void);
const char *migrate_tls_authz(void);
const char *migrate_tls_creds(void);
+const char *migrate_tls_hostname(void);
uint64_t migrate_xbzrle_cache_size(void);
/* parameters setters */
diff --git a/migration/tls.c b/migration/tls.c
index 184db4d..cd29177 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -130,8 +130,9 @@
return NULL;
}
- if (s->parameters.tls_hostname && *s->parameters.tls_hostname) {
- hostname = s->parameters.tls_hostname;
+ const char *tls_hostname = migrate_tls_hostname();
+ if (tls_hostname && *tls_hostname) {
+ hostname = tls_hostname;
}
return qio_channel_tls_new_client(ioc, creds, hostname, errp);