qemu-kvm/SOURCES/kvm-migration-rename-enabled_capabilities-to-capabilitie.patch
2023-11-07 09:43:59 +00:00

330 lines
11 KiB
Diff

From ee566ec12099992f9134bda1db92dd568427245a Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Wed, 1 Mar 2023 18:26:59 +0100
Subject: [PATCH 18/56] migration: rename enabled_capabilities to capabilities
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Peter Xu <peterx@redhat.com>
RH-MergeRequest: 162: migration: Pretty failures for postcopy on unsupported memory types
RH-Bugzilla: 2057267
RH-Acked-by: Leonardo Brás <leobras@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: quintela1 <quintela@redhat.com>
RH-Commit: [17/50] 841a27addf273d8f559bc8ebd2c854200e8ca673 (peterx/qemu-kvm)
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>
(cherry picked from commit 0cec2056ff67557c18d7b8ab1b70ab47c9e31f2f)
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/migration.c | 52 +++++++++++++++++++++----------------------
migration/migration.h | 2 +-
migration/rdma.c | 4 ++--
migration/savevm.c | 6 ++---
4 files changed, 31 insertions(+), 33 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index f1b3439e5f..d8e5fb6226 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -364,8 +364,7 @@ static bool migrate_late_block_activate(void)
s = migrate_get_current();
- return s->enabled_capabilities[
- MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE];
+ return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE];
}
/*
@@ -944,7 +943,7 @@ MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
#endif
caps = g_malloc0(sizeof(*caps));
caps->capability = i;
- caps->state = s->enabled_capabilities[i];
+ caps->state = s->capabilities[i];
QAPI_LIST_APPEND(tail, caps);
}
@@ -1494,13 +1493,13 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
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)) {
return;
}
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();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_RELEASE_RAM];
+ return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM];
}
bool migrate_postcopy_ram(void)
@@ -2578,7 +2577,7 @@ bool migrate_postcopy_ram(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM];
+ return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM];
}
bool migrate_postcopy(void)
@@ -2592,7 +2591,7 @@ bool migrate_auto_converge(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE];
+ return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE];
}
bool migrate_zero_blocks(void)
@@ -2601,7 +2600,7 @@ bool migrate_zero_blocks(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS];
+ return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS];
}
bool migrate_postcopy_blocktime(void)
@@ -2610,7 +2609,7 @@ bool migrate_postcopy_blocktime(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME];
+ return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME];
}
bool migrate_use_compression(void)
@@ -2619,7 +2618,7 @@ bool migrate_use_compression(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_COMPRESS];
+ return s->capabilities[MIGRATION_CAPABILITY_COMPRESS];
}
int migrate_compress_level(void)
@@ -2664,7 +2663,7 @@ bool migrate_dirty_bitmaps(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS];
+ return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS];
}
bool migrate_ignore_shared(void)
@@ -2673,7 +2672,7 @@ bool migrate_ignore_shared(void)
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)
@@ -2682,7 +2681,7 @@ bool migrate_validate_uuid(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID];
+ return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID];
}
bool migrate_use_events(void)
@@ -2691,7 +2690,7 @@ bool migrate_use_events(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_EVENTS];
+ return s->capabilities[MIGRATION_CAPABILITY_EVENTS];
}
bool migrate_use_multifd(void)
@@ -2700,7 +2699,7 @@ bool migrate_use_multifd(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_MULTIFD];
+ return s->capabilities[MIGRATION_CAPABILITY_MULTIFD];
}
bool migrate_pause_before_switchover(void)
@@ -2709,8 +2708,7 @@ bool migrate_pause_before_switchover(void)
s = migrate_get_current();
- return s->enabled_capabilities[
- MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER];
+ return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER];
}
int migrate_multifd_channels(void)
@@ -2757,7 +2755,7 @@ bool migrate_use_zero_copy_send(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND];
+ return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND];
}
#endif
@@ -2776,7 +2774,7 @@ int migrate_use_xbzrle(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE];
+ return s->capabilities[MIGRATION_CAPABILITY_XBZRLE];
}
uint64_t migrate_xbzrle_cache_size(void)
@@ -2803,7 +2801,7 @@ bool migrate_use_block(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK];
+ return s->capabilities[MIGRATION_CAPABILITY_BLOCK];
}
bool migrate_use_return_path(void)
@@ -2812,7 +2810,7 @@ bool migrate_use_return_path(void)
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)
@@ -2830,7 +2828,7 @@ bool migrate_background_snapshot(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
+ return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
}
bool migrate_postcopy_preempt(void)
@@ -2839,7 +2837,7 @@ bool migrate_postcopy_preempt(void)
s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT];
+ return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT];
}
/* migration thread support */
@@ -3584,7 +3582,7 @@ fail:
bool migrate_colo_enabled(void)
{
MigrationState *s = migrate_get_current();
- return s->enabled_capabilities[MIGRATION_CAPABILITY_X_COLO];
+ return s->capabilities[MIGRATION_CAPABILITY_X_COLO];
}
typedef enum MigThrError {
@@ -4447,7 +4445,7 @@ void migration_global_dump(Monitor *mon)
}
#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[] = {
DEFINE_PROP_BOOL("store-global-state", MigrationState,
@@ -4646,7 +4644,7 @@ static bool migration_object_check(MigrationState *ms, Error **errp)
}
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));
}
}
diff --git a/migration/migration.h b/migration/migration.h
index 310ae8901b..04e0860b4e 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -310,7 +310,7 @@ struct MigrationState {
int64_t downtime_start;
int64_t downtime;
int64_t expected_downtime;
- bool enabled_capabilities[MIGRATION_CAPABILITY__MAX];
+ bool capabilities[MIGRATION_CAPABILITY__MAX];
int64_t setup_time;
/*
* Whether guest was running when we enter the completion stage.
diff --git a/migration/rdma.c b/migration/rdma.c
index df646be35e..f35f021963 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -4179,7 +4179,7 @@ void rdma_start_outgoing_migration(void *opaque,
}
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) {
goto err;
@@ -4201,7 +4201,7 @@ void rdma_start_outgoing_migration(void *opaque,
}
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) {
goto return_path_err;
diff --git a/migration/savevm.c b/migration/savevm.c
index aa54a67fda..589ef926ab 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -253,7 +253,7 @@ static uint32_t get_validatable_capabilities_count(void)
uint32_t result = 0;
int 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++;
}
}
@@ -275,7 +275,7 @@ static int configuration_pre_save(void *opaque)
state->capabilities = g_renew(MigrationCapability, state->capabilities,
state->caps_count);
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;
}
}
@@ -325,7 +325,7 @@ static bool configuration_validate_capabilities(SaveState *state)
continue;
}
source_state = test_bit(i, source_caps_bm);
- target_state = s->enabled_capabilities[i];
+ target_state = s->capabilities[i];
if (source_state != target_state) {
error_report("Capability %s is %s, but received capability is %s",
MigrationCapability_str(i),
--
2.39.1