@@ -2567,6 +2567,15 @@ bool migrate_background_snapshot(void)
return s->enabled_capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
}
+bool migrate_auto_quit(void)
+{
+ MigrationState *s;
+
+ s = migrate_get_current();
+
+ return s->enabled_capabilities[MIGRATION_CAPABILITY_AUTO_QUIT];
+}
+
/* migration thread support */
/*
* Something bad happened to the RP stream, mark an error
@@ -3539,7 +3548,10 @@ static void migration_iteration_finish(MigrationState *s)
case MIGRATION_STATUS_COMPLETED:
migration_calculate_complete(s);
runstate_set(RUN_STATE_POSTMIGRATE);
- qemu_system_shutdown_request(SHUTDOWN_CAUSE_MIGRATION_COMPLETED);
+
+ if (migrate_auto_quit()) {
+ qemu_system_shutdown_request(SHUTDOWN_CAUSE_MIGRATION_COMPLETED);
+ }
break;
case MIGRATION_STATUS_ACTIVE:
@@ -349,6 +349,7 @@ int migrate_decompress_threads(void);
bool migrate_use_events(void);
bool migrate_postcopy_blocktime(void);
bool migrate_background_snapshot(void);
+bool migrate_auto_quit(void);
/* Sending on the return path - generic and then for each message type */
void migrate_send_rp_shut(MigrationIncomingState *mis,
@@ -452,6 +452,9 @@
# procedure starts. The VM RAM is saved with running VM.
# (since 6.0)
#
+# @auto-quit: If enabled, QEMU process will exit after a successful migration.
+# (since 6.1)
+#
# Since: 1.2
##
{ 'enum': 'MigrationCapability',
@@ -459,7 +462,8 @@
'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram',
'block', 'return-path', 'pause-before-switchover', 'multifd',
'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
- 'x-ignore-shared', 'validate-uuid', 'background-snapshot'] }
+ 'x-ignore-shared', 'validate-uuid', 'background-snapshot',
+ 'auto-quit'] }
##
# @MigrationCapabilityStatus:
For compatibility, a new migration capability 'auto-quit' is added to control the exit of source QEMU after a successful migration. Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com> --- migration/migration.c | 14 +++++++++++++- migration/migration.h | 1 + qapi/migration.json | 6 +++++- 3 files changed, 19 insertions(+), 2 deletions(-)