diff --git a/docs/COLO-FT.txt b/docs/COLO-FT.txt index 6302469d0e..e2686bb338 100644 --- a/docs/COLO-FT.txt +++ b/docs/COLO-FT.txt @@ -173,7 +173,7 @@ Secondary: { 'execute': 'nbd-server-start', 'arguments': {'addr': {'type': 'inet', 'data': {'host': 'xx.xx.xx.xx', 'port': '8889'} } } } -{'execute': 'nbd-server-add', 'arguments': {'device': 'secondeary-disk0', 'writable': true } } +{'execute': 'nbd-server-add', 'arguments': {'device': 'secondary-disk0', 'writable': true } } Note: a. The qmp command nbd-server-start and nbd-server-add must be run diff --git a/migration/migration.c b/migration/migration.c index 8b36e7f184..b261c1e4ce 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -742,7 +742,7 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp) * Return true if we're already in the middle of a migration * (i.e. any of the active or setup states) */ -static bool migration_is_setup_or_active(int state) +bool migration_is_setup_or_active(int state) { switch (state) { case MIGRATION_STATUS_ACTIVE: diff --git a/migration/migration.h b/migration/migration.h index f7813f8261..e413d4d8b6 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -241,6 +241,8 @@ void migrate_fd_error(MigrationState *s, const Error *error); void migrate_fd_connect(MigrationState *s, Error *error_in); +bool migration_is_setup_or_active(int state); + void migrate_init(MigrationState *s); bool migration_is_blocked(Error **errp); /* True if outgoing migration has entered postcopy phase */ diff --git a/migration/savevm.c b/migration/savevm.c index 9992af4db4..ef707b8c43 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1327,21 +1327,25 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp) MigrationState *ms = migrate_get_current(); MigrationStatus status; - migrate_init(ms); - - ms->to_dst_file = f; + if (migration_is_setup_or_active(ms->state) || + ms->state == MIGRATION_STATUS_CANCELLING || + ms->state == MIGRATION_STATUS_COLO) { + error_setg(errp, QERR_MIGRATION_ACTIVE); + return -EINVAL; + } if (migration_is_blocked(errp)) { - ret = -EINVAL; - goto done; + return -EINVAL; } if (migrate_use_block()) { error_setg(errp, "Block migration and snapshots are incompatible"); - ret = -EINVAL; - goto done; + return -EINVAL; } + migrate_init(ms); + ms->to_dst_file = f; + qemu_mutex_unlock_iothread(); qemu_savevm_state_header(f); qemu_savevm_state_setup(f); @@ -1363,7 +1367,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp) error_setg_errno(errp, -ret, "Error while writing VM state"); } -done: if (ret != 0) { status = MIGRATION_STATUS_FAILED; } else { diff --git a/qapi/migration.json b/qapi/migration.json index 0928f4b727..38d4c41d88 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1317,7 +1317,7 @@ # # @reason: describes the reason for the COLO exit. # -# Since: 3.0 +# Since: 3.1 ## { 'struct': 'COLOStatus', 'data': { 'mode': 'COLOMode', 'reason': 'COLOExitReason' } } @@ -1334,7 +1334,7 @@ # -> { "execute": "query-colo-status" } # <- { "return": { "mode": "primary", "active": true, "reason": "request" } } # -# Since: 3.0 +# Since: 3.1 ## { 'command': 'query-colo-status', 'returns': 'COLOStatus' }