migration: rename enabled_capabilities to capabilities

It is clear from the context what that means, and such a long name
with the extra long names of the capabilities make very difficilut to
stay inside the 80 columns limit.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
This commit is contained in:
Juan Quintela 2023-03-01 18:26:59 +01:00
parent ae30b9b289
commit 0cec2056ff
4 changed files with 31 additions and 33 deletions

View File

@ -364,8 +364,7 @@ static bool migrate_late_block_activate(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[ return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE];
MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE];
} }
/* /*
@ -944,7 +943,7 @@ MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
#endif #endif
caps = g_malloc0(sizeof(*caps)); caps = g_malloc0(sizeof(*caps));
caps->capability = i; caps->capability = i;
caps->state = s->enabled_capabilities[i]; caps->state = s->capabilities[i];
QAPI_LIST_APPEND(tail, caps); QAPI_LIST_APPEND(tail, caps);
} }
@ -1494,13 +1493,13 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
return; return;
} }
memcpy(cap_list, s->enabled_capabilities, sizeof(cap_list)); memcpy(cap_list, s->capabilities, sizeof(cap_list));
if (!migrate_caps_check(cap_list, params, errp)) { if (!migrate_caps_check(cap_list, params, errp)) {
return; return;
} }
for (cap = params; cap; cap = cap->next) { for (cap = params; cap; cap = cap->next) {
s->enabled_capabilities[cap->value->capability] = cap->value->state; s->capabilities[cap->value->capability] = cap->value->state;
} }
} }
@ -2569,7 +2568,7 @@ bool migrate_release_ram(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM];
} }
bool migrate_postcopy_ram(void) bool migrate_postcopy_ram(void)
@ -2578,7 +2577,7 @@ bool migrate_postcopy_ram(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM];
} }
bool migrate_postcopy(void) bool migrate_postcopy(void)
@ -2592,7 +2591,7 @@ bool migrate_auto_converge(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE];
} }
bool migrate_zero_blocks(void) bool migrate_zero_blocks(void)
@ -2601,7 +2600,7 @@ bool migrate_zero_blocks(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS];
} }
bool migrate_postcopy_blocktime(void) bool migrate_postcopy_blocktime(void)
@ -2610,7 +2609,7 @@ bool migrate_postcopy_blocktime(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME];
} }
bool migrate_use_compression(void) bool migrate_use_compression(void)
@ -2619,7 +2618,7 @@ bool migrate_use_compression(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_COMPRESS]; return s->capabilities[MIGRATION_CAPABILITY_COMPRESS];
} }
int migrate_compress_level(void) int migrate_compress_level(void)
@ -2664,7 +2663,7 @@ bool migrate_dirty_bitmaps(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS];
} }
bool migrate_ignore_shared(void) bool migrate_ignore_shared(void)
@ -2673,7 +2672,7 @@ bool migrate_ignore_shared(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED];
} }
bool migrate_validate_uuid(void) bool migrate_validate_uuid(void)
@ -2682,7 +2681,7 @@ bool migrate_validate_uuid(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID];
} }
bool migrate_use_events(void) bool migrate_use_events(void)
@ -2691,7 +2690,7 @@ bool migrate_use_events(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_EVENTS]; return s->capabilities[MIGRATION_CAPABILITY_EVENTS];
} }
bool migrate_use_multifd(void) bool migrate_use_multifd(void)
@ -2700,7 +2699,7 @@ bool migrate_use_multifd(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_MULTIFD]; return s->capabilities[MIGRATION_CAPABILITY_MULTIFD];
} }
bool migrate_pause_before_switchover(void) bool migrate_pause_before_switchover(void)
@ -2709,8 +2708,7 @@ bool migrate_pause_before_switchover(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[ return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER];
MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER];
} }
int migrate_multifd_channels(void) int migrate_multifd_channels(void)
@ -2757,7 +2755,7 @@ bool migrate_use_zero_copy_send(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND];
} }
#endif #endif
@ -2776,7 +2774,7 @@ int migrate_use_xbzrle(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE]; return s->capabilities[MIGRATION_CAPABILITY_XBZRLE];
} }
uint64_t migrate_xbzrle_cache_size(void) uint64_t migrate_xbzrle_cache_size(void)
@ -2803,7 +2801,7 @@ bool migrate_use_block(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK]; return s->capabilities[MIGRATION_CAPABILITY_BLOCK];
} }
bool migrate_use_return_path(void) bool migrate_use_return_path(void)
@ -2812,7 +2810,7 @@ bool migrate_use_return_path(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH];
} }
bool migrate_use_block_incremental(void) bool migrate_use_block_incremental(void)
@ -2830,7 +2828,7 @@ bool migrate_background_snapshot(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
} }
bool migrate_postcopy_preempt(void) bool migrate_postcopy_preempt(void)
@ -2839,7 +2837,7 @@ bool migrate_postcopy_preempt(void)
s = migrate_get_current(); s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT];
} }
/* migration thread support */ /* migration thread support */
@ -3581,7 +3579,7 @@ fail:
bool migrate_colo_enabled(void) bool migrate_colo_enabled(void)
{ {
MigrationState *s = migrate_get_current(); MigrationState *s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_X_COLO]; return s->capabilities[MIGRATION_CAPABILITY_X_COLO];
} }
typedef enum MigThrError { typedef enum MigThrError {
@ -4444,7 +4442,7 @@ void migration_global_dump(Monitor *mon)
} }
#define DEFINE_PROP_MIG_CAP(name, x) \ #define DEFINE_PROP_MIG_CAP(name, x) \
DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false) DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false)
static Property migration_properties[] = { static Property migration_properties[] = {
DEFINE_PROP_BOOL("store-global-state", MigrationState, DEFINE_PROP_BOOL("store-global-state", MigrationState,
@ -4643,7 +4641,7 @@ static bool migration_object_check(MigrationState *ms, Error **errp)
} }
for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) { for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
if (ms->enabled_capabilities[i]) { if (ms->capabilities[i]) {
QAPI_LIST_PREPEND(head, migrate_cap_add(i, true)); QAPI_LIST_PREPEND(head, migrate_cap_add(i, true));
} }
} }

View File

@ -310,7 +310,7 @@ struct MigrationState {
int64_t downtime_start; int64_t downtime_start;
int64_t downtime; int64_t downtime;
int64_t expected_downtime; int64_t expected_downtime;
bool enabled_capabilities[MIGRATION_CAPABILITY__MAX]; bool capabilities[MIGRATION_CAPABILITY__MAX];
int64_t setup_time; int64_t setup_time;
/* /*
* Whether guest was running when we enter the completion stage. * Whether guest was running when we enter the completion stage.

View File

@ -4179,7 +4179,7 @@ void rdma_start_outgoing_migration(void *opaque,
} }
ret = qemu_rdma_source_init(rdma, ret = qemu_rdma_source_init(rdma,
s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp);
if (ret) { if (ret) {
goto err; goto err;
@ -4201,7 +4201,7 @@ void rdma_start_outgoing_migration(void *opaque,
} }
ret = qemu_rdma_source_init(rdma_return_path, ret = qemu_rdma_source_init(rdma_return_path,
s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp);
if (ret) { if (ret) {
goto return_path_err; goto return_path_err;

View File

@ -253,7 +253,7 @@ static uint32_t get_validatable_capabilities_count(void)
uint32_t result = 0; uint32_t result = 0;
int i; int i;
for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) { for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
if (should_validate_capability(i) && s->enabled_capabilities[i]) { if (should_validate_capability(i) && s->capabilities[i]) {
result++; result++;
} }
} }
@ -275,7 +275,7 @@ static int configuration_pre_save(void *opaque)
state->capabilities = g_renew(MigrationCapability, state->capabilities, state->capabilities = g_renew(MigrationCapability, state->capabilities,
state->caps_count); state->caps_count);
for (i = j = 0; i < MIGRATION_CAPABILITY__MAX; i++) { for (i = j = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
if (should_validate_capability(i) && s->enabled_capabilities[i]) { if (should_validate_capability(i) && s->capabilities[i]) {
state->capabilities[j++] = i; state->capabilities[j++] = i;
} }
} }
@ -325,7 +325,7 @@ static bool configuration_validate_capabilities(SaveState *state)
continue; continue;
} }
source_state = test_bit(i, source_caps_bm); source_state = test_bit(i, source_caps_bm);
target_state = s->enabled_capabilities[i]; target_state = s->capabilities[i];
if (source_state != target_state) { if (source_state != target_state) {
error_report("Capability %s is %s, but received capability is %s", error_report("Capability %s is %s, but received capability is %s",
MigrationCapability_str(i), MigrationCapability_str(i),