migration: disallow change capabilities in COLO state
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>
This commit is contained in:
parent
ecbfec6d77
commit
d70178a88f
@ -2785,10 +2785,7 @@ static void migration_iteration_finish(MigrationState *s)
|
|||||||
runstate_set(RUN_STATE_POSTMIGRATE);
|
runstate_set(RUN_STATE_POSTMIGRATE);
|
||||||
break;
|
break;
|
||||||
case MIGRATION_STATUS_COLO:
|
case MIGRATION_STATUS_COLO:
|
||||||
if (!migrate_colo()) {
|
assert(migrate_colo());
|
||||||
error_report("%s: critical error: calling COLO code without "
|
|
||||||
"COLO enabled", __func__);
|
|
||||||
}
|
|
||||||
migrate_start_colo_process(s);
|
migrate_start_colo_process(s);
|
||||||
s->vm_was_running = true;
|
s->vm_was_running = true;
|
||||||
/* Fallthrough */
|
/* Fallthrough */
|
||||||
|
@ -598,7 +598,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
|
|||||||
MigrationCapabilityStatusList *cap;
|
MigrationCapabilityStatusList *cap;
|
||||||
bool new_caps[MIGRATION_CAPABILITY__MAX];
|
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);
|
error_setg(errp, QERR_MIGRATION_ACTIVE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user