From: Kunkun Jiang <jiangkunkun@huawei.com>
To: Juan Quintela <quintela@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: wanghaibin.wang@huawei.com, jiangkunkun@huawei.com
Subject: [PATCH 2/2] qapi/migration: Add a new migration capability 'auto-quit'
Date: Mon, 5 Jul 2021 20:36:53 +0800 [thread overview]
Message-ID: <20210705123653.1315-3-jiangkunkun@huawei.com> (raw)
In-Reply-To: <20210705123653.1315-1-jiangkunkun@huawei.com>
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(-)
diff --git a/migration/migration.c b/migration/migration.c
index 16782c93c2..82ad6d35b2 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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:
diff --git a/migration/migration.h b/migration/migration.h
index 2ebb740dfa..a72b178d35 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -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,
diff --git a/qapi/migration.json b/qapi/migration.json
index 1124a2dda8..26c1a52c56 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -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:
--
2.23.0
prev parent reply other threads:[~2021-07-05 12:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 12:36 [PATCH 0/2] Auto exit source QEMU process after a successful migration Kunkun Jiang
2021-07-05 12:36 ` [PATCH 1/2] qapi/run-state: Add a new shutdown cause 'migration-completed' Kunkun Jiang
2021-07-05 12:48 ` Daniel P. Berrangé
2021-07-05 13:22 ` Kunkun Jiang
2021-07-06 10:27 ` Dr. David Alan Gilbert
2021-07-07 2:34 ` Kunkun Jiang
2021-07-14 18:39 ` Dr. David Alan Gilbert
2021-07-05 12:36 ` Kunkun Jiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210705123653.1315-3-jiangkunkun@huawei.com \
--to=jiangkunkun@huawei.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=wanghaibin.wang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).