migration: Unregister yank if migration setup fails
PATCH 1/1 migration: Unregister yank if migration setup fails
Currently, if a qemu instance is started with "-incoming defer" and an incorect parameter is passed to "migrate_incoming", it will print the expected error and reply with "duplicate yank instance" for any upcoming "migrate_incoming" command.
This renders current qemu process unusable, and requires a new qemu process to be started before accepting a migration.
This is caused by a yank_register_instance() that happens in qemu_start_incoming_migration() but is never reverted if any error happens.
Solves this by unregistering the instance if anything goes wrong in the function, allowing a new "migrate_incoming" command to be accepted.
Fixes b5eea99ec2f ("migration: Add yank feature", 2021-01-13)
Signed-off-by Leonardo Bras <[email protected]>
--- migration/migration.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
migration/migration.c +5 -1
@@ -474,9 +474,13 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp) }else if (strstart (uri,"fd:" , &p)) {fd_start_incoming_migration (p, errp); }else { -yank_unregister_instance (MIGRATION_YANK_INSTANCE );error_setg (errp,"unknown migration protocol: %s" , uri); } + +if (*errp) { +yank_unregister_instance (MIGRATION_YANK_INSTANCE ); + } + }static void process_incoming_migration_bh (void *opaque)
Signature · 1 line
2.32.0