[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/10] migration: disallow change capabilities in COLO state
From: |
Juan Quintela |
Subject: |
[PULL 09/10] migration: disallow change capabilities in COLO state |
Date: |
Tue, 9 May 2023 21:17:23 +0200 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
COLO is not listed as running state in migrate_is_running(), so, it's
theoretically possible to disable colo capability in COLO state and the
unexpected error in migration_iteration_finish() is reachable.
Let's disallow that in qmp_migrate_set_capabilities. Than the error
becomes absolutely unreachable: we can get into COLO state only with
enabled capability and can't disable it while we are in COLO state. So
substitute the error by simple assertion.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20230428194928.1426370-10-vsementsov@yandex-team.ru>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/migration.c | 5 +----
migration/options.c | 2 +-
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 230f91f5a7..4959f7ee44 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2781,10 +2781,7 @@ static void migration_iteration_finish(MigrationState *s)
runstate_set(RUN_STATE_POSTMIGRATE);
break;
case MIGRATION_STATUS_COLO:
- if (!migrate_colo()) {
- error_report("%s: critical error: calling COLO code without "
- "COLO enabled", __func__);
- }
+ assert(migrate_colo());
migrate_start_colo_process(s);
s->vm_was_running = true;
/* Fallthrough */
diff --git a/migration/options.c b/migration/options.c
index 9d92b15b76..7ed88b7b32 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -598,7 +598,7 @@ void
qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
MigrationCapabilityStatusList *cap;
bool new_caps[MIGRATION_CAPABILITY__MAX];
- if (migration_is_running(s->state)) {
+ if (migration_is_running(s->state) || migration_in_colo_state()) {
error_setg(errp, QERR_MIGRATION_ACTIVE);
return;
}
--
2.40.0
- [PULL 00/10] Migration 20230509 patches, Juan Quintela, 2023/05/09
- [PULL 01/10] ram: Add public helper to set colo bitmap, Juan Quintela, 2023/05/09
- [PULL 02/10] ram: Let colo_flush_ram_cache take the bitmap_mutex, Juan Quintela, 2023/05/09
- [PULL 03/10] multifd: Add the ramblock to MultiFDRecvParams, Juan Quintela, 2023/05/09
- [PULL 04/10] block/meson.build: prefer positive condition for replication, Juan Quintela, 2023/05/09
- [PULL 05/10] colo: make colo_checkpoint_notify static and provide simpler API, Juan Quintela, 2023/05/09
- [PULL 06/10] build: move COLO under CONFIG_REPLICATION, Juan Quintela, 2023/05/09
- [PULL 07/10] migration: drop colo_incoming_thread from MigrationIncomingState, Juan Quintela, 2023/05/09
- [PULL 09/10] migration: disallow change capabilities in COLO state,
Juan Quintela <=
- [PULL 08/10] migration: process_incoming_migration_co: simplify code flow around ret, Juan Quintela, 2023/05/09
- [PULL 10/10] migration: block incoming colo when capability is disabled, Juan Quintela, 2023/05/09
- Re: [PULL 00/10] Migration 20230509 patches, Richard Henderson, 2023/05/10