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)
This commit is contained in:
Juan Quintela 2023-03-02 12:37:21 +01:00
parent 2eb0308bbd
commit 1f2f366c32
3 changed files with 11 additions and 2 deletions

View File

@ -596,6 +596,13 @@ const char *migrate_tls_creds(void)
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();

View File

@ -82,6 +82,7 @@ int migrate_multifd_zstd_level(void);
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 */

View File

@ -130,8 +130,9 @@ QIOChannelTLS *migration_tls_client_create(MigrationState *s,
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);