migration: Move migrate_use_tls() to options.c

Once there, rename it to migrate_tls() and make it return bool for
consistency.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

---

Fix typos found by fabiano
This commit is contained in:
Juan Quintela 2023-03-02 10:41:23 +01:00
parent 66f8b5a5ad
commit 10d4703be5
5 changed files with 13 additions and 13 deletions

View File

@ -2177,15 +2177,6 @@ void qmp_migrate_continue(MigrationStatus state, Error **errp)
qemu_sem_post(&s->pause_sem); qemu_sem_post(&s->pause_sem);
} }
int migrate_use_tls(void)
{
MigrationState *s;
s = migrate_get_current();
return s->parameters.tls_creds && *s->parameters.tls_creds;
}
/* migration thread support */ /* migration thread support */
/* /*
* Something bad happened to the RP stream, mark an error * Something bad happened to the RP stream, mark an error

View File

@ -447,8 +447,6 @@ bool migration_is_blocked(Error **errp);
bool migration_in_postcopy(void); bool migration_in_postcopy(void);
MigrationState *migrate_get_current(void); MigrationState *migrate_get_current(void);
int migrate_use_tls(void);
uint64_t ram_get_total_transferred_pages(void); uint64_t ram_get_total_transferred_pages(void);
/* Sending on the return path - generic and then for each message type */ /* Sending on the return path - generic and then for each message type */

View File

@ -214,6 +214,15 @@ bool migrate_postcopy(void)
return migrate_postcopy_ram() || migrate_dirty_bitmaps(); return migrate_postcopy_ram() || migrate_dirty_bitmaps();
} }
bool migrate_tls(void)
{
MigrationState *s;
s = migrate_get_current();
return s->parameters.tls_creds && *s->parameters.tls_creds;
}
typedef enum WriteTrackingSupport { typedef enum WriteTrackingSupport {
WT_SUPPORT_UNKNOWN = 0, WT_SUPPORT_UNKNOWN = 0,
WT_SUPPORT_ABSENT, WT_SUPPORT_ABSENT,
@ -368,7 +377,7 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
new_caps[MIGRATION_CAPABILITY_COMPRESS] || new_caps[MIGRATION_CAPABILITY_COMPRESS] ||
new_caps[MIGRATION_CAPABILITY_XBZRLE] || new_caps[MIGRATION_CAPABILITY_XBZRLE] ||
migrate_multifd_compression() || migrate_multifd_compression() ||
migrate_use_tls())) { migrate_tls())) {
error_setg(errp, error_setg(errp,
"Zero copy only available for non-compressed non-TLS multifd migration"); "Zero copy only available for non-compressed non-TLS multifd migration");
return false; return false;

View File

@ -46,6 +46,7 @@ bool migrate_zero_copy_send(void);
*/ */
bool migrate_postcopy(void); bool migrate_postcopy(void);
bool migrate_tls(void);
/* capabilities helpers */ /* capabilities helpers */

View File

@ -22,6 +22,7 @@
#include "channel.h" #include "channel.h"
#include "migration.h" #include "migration.h"
#include "tls.h" #include "tls.h"
#include "options.h"
#include "crypto/tlscreds.h" #include "crypto/tlscreds.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qapi/error.h" #include "qapi/error.h"
@ -165,7 +166,7 @@ void migration_tls_channel_connect(MigrationState *s,
bool migrate_channel_requires_tls_upgrade(QIOChannel *ioc) bool migrate_channel_requires_tls_upgrade(QIOChannel *ioc)
{ {
if (!migrate_use_tls()) { if (!migrate_tls()) {
return false; return false;
} }