[libvirt PATCH v2 66/81] qemu: Implement VIR_MIGRATE_POSTCOPY_RESUME for Prepare phase

Jiri Denemark jdenemar at redhat.com
Fri Jun 3 12:27:55 UTC 2022


On Wed, Jun 01, 2022 at 14:50:06 +0200, Jiri Denemark wrote:
> The QEMU process is already running, all we need to do is to call
> migrate-recover QMP command. Except for some checks and cookie handling,
> of course.
> 
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> Reviewed-by: Peter Krempa <pkrempa at redhat.com>
> Reviewed-by: Pavel Hrdina <phrdina at redhat.com>
> ---
> 
> Notes:
>     Version 2:
>     - no change
> 
>  src/qemu/qemu_migration.c | 99 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 99 insertions(+)

The following patch needs to be squashed in to make sure the
automatically allocated port is properly released at the end of resume.

Jirka

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index dbebd215b4..22a80d8430 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3485,6 +3485,7 @@ qemuMigrationDstPrepareResume(virQEMUDriver *driver,
                               const char *origname,
                               const char *protocol,
                               unsigned short port,
+                              bool autoPort,
                               const char *listenAddress,
                               unsigned long flags)
 {
@@ -3555,6 +3556,9 @@ qemuMigrationDstPrepareResume(virQEMUDriver *driver,
     virCloseCallbacksSet(driver->closeCallbacks, vm, conn,
                          qemuMigrationAnyConnectionClosed);

+    if (autoPort)
+        priv->migrationPort = port;
+
  cleanup:
     qemuProcessIncomingDefFree(incoming);
     if (ret < 0)
@@ -3633,7 +3637,8 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver,
     if (flags & VIR_MIGRATE_POSTCOPY_RESUME) {
         return qemuMigrationDstPrepareResume(driver, dconn, cookiein, cookieinlen,
                                              cookieout, cookieoutlen,
-                                             *def, origname, protocol, port,
+                                             *def, origname, protocol,
+                                             port, autoPort,
                                              listenAddress, flags);
     }


More information about the libvir-list mailing list