Initialize the migration object as early as possible so that migration
configuration commands may be sent during the precreate phase. Also,
start listening for the incoming migration connection during precreate,
so that the listen port number is assigned (if dynamic), and the user
can discover it during precreate via query-migrate. The precreate phase
will be delineated in a subsequent patch.
The code previously called migration_object_init after memory backends
were created so that a subsequent migrate-set-capabilities call to set
MIGRATION_CAPABILITY_POSTCOPY_RAM would verify all backends support
postcopy. See migrate_caps_check and postcopy_ram_supported_by_host.
The new code calls migration_object_init before backends are created.
However, migrate-set-capabilities will only be received during the
precreate phase for CPR, and CPR does not support postcopy. If the
precreate phase is generalized in the future, then the ram compatibility
check must be deferred to the start of migration.
Signed-off-by: Steve Sistare <steven.sist...@oracle.com>
---
system/vl.c | 35 +++++++++++++----------------------
1 file changed, 13 insertions(+), 22 deletions(-)
diff --git a/system/vl.c b/system/vl.c
index bca2292..d32203c 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -2753,17 +2753,7 @@ void qmp_x_exit_preconfig(Error **errp)
replay_vmstate_init();
}
- if (incoming) {
- Error *local_err = NULL;
- if (strcmp(incoming, "defer") != 0) {
- qmp_migrate_incoming(incoming, false, NULL, true, true,
- &local_err);
- if (local_err) {
- error_reportf_err(local_err, "-incoming %s: ", incoming);
- exit(1);
- }
- }
- } else if (autostart) {
+ if (!incoming && autostart) {
qmp_cont(NULL);
}
}
@@ -3751,6 +3741,18 @@ void qemu_init(int argc, char **argv)
* called from do_configure_accelerator().
*/
+ /* Creates a QOM object */
+ migration_object_init();
+
+ if (incoming && !g_str_equal(incoming, "defer")) {
+ Error *local_err = NULL;
+ qmp_migrate_incoming(incoming, false, NULL, true, true, &local_err);
+ if (local_err) {
+ error_reportf_err(local_err, "-incoming %s: ", incoming);
+ exit(1);
+ }
+ }