[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/43] migration: Move migrate_colo_enabled() to options.c
From: |
Juan Quintela |
Subject: |
[PATCH 05/43] migration: Move migrate_colo_enabled() to options.c |
Date: |
Thu, 2 Mar 2023 17:33:32 +0100 |
Once that we are there, we rename the function to migrate_colo() to be
consistent with all other capabilities.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/migration.h | 1 -
migration/options.h | 1 +
migration/migration.c | 16 +++++-----------
migration/options.c | 6 ++++++
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/migration/migration.h b/migration/migration.h
index 68851e485d..1ac11fdba9 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -424,7 +424,6 @@ bool migrate_use_zero_copy_send(void);
int migrate_use_tls(void);
int migrate_use_xbzrle(void);
uint64_t migrate_xbzrle_cache_size(void);
-bool migrate_colo_enabled(void);
bool migrate_use_block(void);
bool migrate_use_block_incremental(void);
diff --git a/migration/options.h b/migration/options.h
index bae032375a..5d2d4298cd 100644
--- a/migration/options.h
+++ b/migration/options.h
@@ -20,6 +20,7 @@
bool migrate_auto_converge(void);
bool migrate_background_snapshot(void);
+bool migrate_colo(void);
bool migrate_dirty_bitmaps(void);
bool migrate_ignore_shared(void);
bool migrate_late_block_activate(void);
diff --git a/migration/migration.c b/migration/migration.c
index 790848ef1c..03884f2f73 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2409,7 +2409,7 @@ static bool migrate_prepare(MigrationState *s, bool blk,
bool blk_inc,
}
if (blk || blk_inc) {
- if (migrate_colo_enabled()) {
+ if (migrate_colo()) {
error_setg(errp, "No disk migration is required in COLO mode");
return false;
}
@@ -3290,7 +3290,7 @@ static void migration_completion(MigrationState *s)
ret = global_state_store();
if (!ret) {
- bool inactivate = !migrate_colo_enabled();
+ bool inactivate = !migrate_colo();
ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
trace_migration_completion_vm_stop(ret);
if (ret >= 0) {
@@ -3349,7 +3349,7 @@ static void migration_completion(MigrationState *s)
goto fail_invalidate;
}
- if (migrate_colo_enabled() && s->state == MIGRATION_STATUS_ACTIVE) {
+ if (migrate_colo() && s->state == MIGRATION_STATUS_ACTIVE) {
/* COLO does not support postcopy */
migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE,
MIGRATION_STATUS_COLO);
@@ -3427,12 +3427,6 @@ fail:
MIGRATION_STATUS_FAILED);
}
-bool migrate_colo_enabled(void)
-{
- MigrationState *s = migrate_get_current();
- return s->capabilities[MIGRATION_CAPABILITY_X_COLO];
-}
-
typedef enum MigThrError {
/* No error detected */
MIG_THR_ERR_NONE = 0,
@@ -3763,7 +3757,7 @@ static void migration_iteration_finish(MigrationState *s)
runstate_set(RUN_STATE_POSTMIGRATE);
break;
case MIGRATION_STATUS_COLO:
- if (!migrate_colo_enabled()) {
+ if (!migrate_colo()) {
error_report("%s: critical error: calling COLO code without "
"COLO enabled", __func__);
}
@@ -3959,7 +3953,7 @@ static void *migration_thread(void *opaque)
qemu_savevm_send_postcopy_advise(s->to_dst_file);
}
- if (migrate_colo_enabled()) {
+ if (migrate_colo()) {
/* Notify migration destination that we enable COLO */
qemu_savevm_send_colo_enable(s->to_dst_file);
}
diff --git a/migration/options.c b/migration/options.c
index 47337a9a29..6904d054a9 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -35,6 +35,12 @@ bool migrate_background_snapshot(void)
return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
}
+bool migrate_colo(void)
+{
+ MigrationState *s = migrate_get_current();
+ return s->capabilities[MIGRATION_CAPABILITY_X_COLO];
+}
+
bool migrate_dirty_bitmaps(void)
{
MigrationState *s;
--
2.39.2
- [PATCH 00/43] Migration: Create options.c for capabilities/params/properties, Juan Quintela, 2023/03/02
- [PATCH 01/43] migration: rename enabled_capabilities to capabilities, Juan Quintela, 2023/03/02
- [PATCH 02/43] migration: Pass migrate_caps_check() the old and new caps, Juan Quintela, 2023/03/02
- [PATCH 03/43] migration: Create migration_cap_set(), Juan Quintela, 2023/03/02
- [PATCH 04/43] migration: create options.c, Juan Quintela, 2023/03/02
- [PATCH 06/43] migration: Move migrate_use_compression() to options.c, Juan Quintela, 2023/03/02
- [PATCH 05/43] migration: Move migrate_colo_enabled() to options.c,
Juan Quintela <=
- [PATCH 09/43] migration: Move migrate_use_zero_copy_send() to options.c, Juan Quintela, 2023/03/02
- [PATCH 08/43] migration: Move migrate_use_multifd() to options.c, Juan Quintela, 2023/03/02
- [PATCH 07/43] migration: Move migrate_use_events() to options.c, Juan Quintela, 2023/03/02
- [PATCH 10/43] migration: Move migrate_use_xbzrle() to options.c, Juan Quintela, 2023/03/02
- [PATCH 12/43] migration: Move migrate_use_return() to options.c, Juan Quintela, 2023/03/02
- [PATCH 11/43] migration: Move migrate_use_block() to options.c, Juan Quintela, 2023/03/02
- [PATCH 13/43] migration: Create migrate_rdma_pin_all() function, Juan Quintela, 2023/03/02
- [PATCH 15/43] migration: Move qmp_query_migrate_capabilities() to options.c, Juan Quintela, 2023/03/02
- [PATCH 14/43] migration: Move migrate_caps_check() to options.c, Juan Quintela, 2023/03/02
- [PATCH 16/43] migration: Move qmp_migrate_set_capabilities() to options.c, Juan Quintela, 2023/03/02