migration: fix inability to save VM after snapshot
PATCH 1/1 migration: fix inability to save VM after snapshot
The following sequence of operations fails:
virsh start vm
virsh snapshot-create vm
virshh save vm --file file
with the following error
error: Failed to save domain vm to file
error: internal error: unable to execute QEMU command 'migrate':
There's a migration process in progress
The problem is that qemu_savevm_state() calls migrate_init() which sets migration state to MIGRATION_STATUS_SETUP and never cleaned it up. This patch do the job.
--- migration/savevm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
migration/savevm.c +11 -1
@@ -1149,10 +1149,12 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp) .shared = 0 };MigrationState *ms =migrate_init (¶ms); +MigrationStatus status; ms->to_dst_file = f;if (migration_is_blocked (errp)) { -return -EINVAL ; + ret = -EINVAL ; + goto done; }qemu_mutex_unlock_iothread ();
@@ -1175,6 +1177,14 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)if (ret !=0 ) {error_setg_errno (errp, -ret,"Error while writing VM state" ); } + +done: +if (ret !=0 ) { + status =MIGRATION_STATUS_FAILED ; + }else { + status =MIGRATION_STATUS_COMPLETED ; + } +migrate_set_state (&ms->state,MIGRATION_STATUS_SETUP , status);return ret; }
Signature · 1 line
2.5.0
Quoted 9 lines · * Denis V. Lunev ([email protected]) wrote:
The following sequence of operations fails:
virsh start vm
virsh snapshot-create vm
virshh save vm --file file
with the following error
error: Failed to save domain vm to file
error: internal error: unable to execute QEMU command 'migrate':
There's a migration process in progress
Quoted 7 lines
The problem is that
qemu_savevm_state()callsmigrate_init()which sets migration state toMIGRATION_STATUS_SETUPand never cleaned it up. This patch do the job.Signed-off-by Denis V. Lunev <[email protected]>CC Juan Quintela <[email protected]>CC Amit Shah <[email protected]>
Quoted 41 lines
--- migration/savevm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)migration/savevm.c +11
-1@@ -1149,10 +1149,12 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp) .shared = 0 };MigrationState *ms =migrate_init (¶ms); +MigrationStatus status; ms->to_dst_file = f;if (migration_is_blocked (errp)) { -return -EINVAL ; + ret = -EINVAL ; + goto done; }qemu_mutex_unlock_iothread ();@@ -1175,6 +1177,14 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)if (ret !=0 ) {error_setg_errno (errp, -ret,"Error while writing VM state" ); } + +done: +if (ret !=0 ) { + status =MIGRATION_STATUS_FAILED ; + }else { + status =MIGRATION_STATUS_COMPLETED ; + } +migrate_set_state (&ms->state,MIGRATION_STATUS_SETUP , status);return ret; }Signature · 1 line
2.5.0
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK