Avoid migration if guest is in postmigrated status
PATCH 1/1 Avoid migration if guest is in postmigrated status
This patch is to avoid executing migrations twice, which causes coredump. After the migration has been completed, guest is in postmigrated status on source host and the block device is inactive. If executing migration again, it will cause coredump and a block error. For exmaple, executing #migrate "exec:cat>file" twice on source host, block error:bdrv_inactivate_recurse: Assertion `!(bs->open_flags & BDRV_O_INACTIVE)' failed
--- migration/migration.c | 5 +++++ 1 file changed, 5 insertions(+)
migration/migration.c +5 -0
@@ -2115,6 +2115,11 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,return false; } +if (runstate_check (RUN_STATE_POSTMIGRATE )) { +error_setg (errp,"Unable to migrate, guest has been migrated" ); +return false; + } +if (migration_is_blocked (errp)) {return false; }
Signature · 1 line
2.18.4
Quoted 8 lines · Li Zhang
This patch is to avoid executing migrations twice, which causes coredump. After the migration has been completed, guest is in postmigrated status on source host and the block device is inactive. If executing migration again, it will cause coredump and a block error. For exmaple, executing #migrate "exec:cat>file" twice on source host, block error:
bdrv_inactivate_recurse: Assertion `!(bs->open_flags &BDRV_O_INACTIVE)' failedSigned-off-by Li Zhang <[email protected]>
There is an existing proposal for this (the same approach) in
https://lore.kernel.org/r/[email protected].
Quoted 22 lines
--- migration/migration.c | 5 +++++ 1 file changed, 5 insertions(+)migration/migration.c +5
-0@@ -2115,6 +2115,11 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,return false; } +if (runstate_check (RUN_STATE_POSTMIGRATE )) { +error_setg (errp,"Unable to migrate, guest has been migrated" ); +return false; + } +if (migration_is_blocked (errp)) {return false; }Signature · 1 line
2.18.4
dme.
Signature · 1 line
Ah, oh your hair is beautiful.
Thanks for telling me that. I didn't notice this patch.
I just caught this error when I used it and read the source code, it should be fixed.
Thanks
Li
Quoted 44 lines · David Edmondson
Quoted 2 lines · Li Zhang
This patch is to avoid executing migrations twice, which causes coredump. After the migration has been completed, guest is in
postmigrated
Quoted 4 lines
status on source host and the block device is inactive. If executing migration again, it will cause coredump and a block error. For exmaple, executing #migrate "exec:cat>file" twice on source host, block error:
bdrv_inactivate_recurse: Assertion `!(bs->open_flags &BDRV_O_INACTIVE)'failed
Quoted 2 lines
Signed-off-by Li Zhang <[email protected]>There is an existing proposal for this (the same approach) in
https://lore.kernel.org/r/[email protected].migration/migration.c static bool migrate_prepare(MigrationState *s,
Quoted 9 lines
--- migration/migration.c | 5 +++++ 1 file changed, 5 insertions(+)migration/migration.c +0
-0@@ -2115,6 +2115,11 @@ static bool migrate_prepare(MigrationState *s,bool blk, bool
blk_inc,Quoted 12 lines
migration/migration.c +5
-1return false; } +if (runstate_check (RUN_STATE_POSTMIGRATE )) { +error_setg (errp,"Unable to migrate, guest has been migrated" ); +return false; + } +if (migration_is_blocked (errp)) {return false; } --Quoted 1 line
2.18.4
dme.
--
Ah, oh your hair is beautiful.