[PATCH 1/3] Revert "qemu: migration: Improve handling of VIR_MIGRATE_PARAM_DEST_XML with VIR_MIGRATE_PERSIST_DEST"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The original intention was to improve the behaviour of the
VIR_MIGRATE_PERSIST_DEST flag which makes the VM persistent after
migration on the destination when used with VIR_MIGRATE_PARAM_DEST_XML.

While it worked as intended with p2p migration where the migration is
driven from the virtqemud instance on the source of the migration, which
can distinguish between the user-provided input XML and the one fetched
from the source of the migration, it's not easily possible to achieve
the same behaviour with normal migration driven from the client library.

The approach also still had corner cases (originally deemed worth
changing) such as if the persistent definition was modified it would be
overwritten.

As there is no clear fix which would improve both styles of migrations
with no corner cases revert the change.

Upcoming commits will modify the documentation to add warning about the
use of VIR_MIGRATE_PERSIST_DEST with VIR_MIGRATE_PARAM_DEST_XML/xmlin
without using VIR_MIGRATE_PARAM_PERSIST_XML instead of a code fix.

This reverts commit 6a385590926d01ab2f2137d1d0833ae797cd2839.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 832b2946e0..26a92d8ee2 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4829,7 +4829,6 @@ qemuMigrationSrcCancel(virDomainObj *vm,
 static int
 qemuMigrationSrcRun(virQEMUDriver *driver,
                     virDomainObj *vm,
-                    const char *xmlin,
                     const char *persist_xml,
                     const char *cookiein,
                     int cookieinlen,
@@ -4902,15 +4901,6 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
                                                           persist_xml,
                                                           NULL, NULL)))
                 goto error;
-        } else if (xmlin) {
-            /* if input XML is provided, use that one as template for the
-             * persistent XML. Otherwise user's changes will be thrown away.
-             */
-            if (!(persistDef = qemuMigrationAnyPrepareDef(driver,
-                                                          priv->qemuCaps,
-                                                          xmlin,
-                                                          NULL, NULL)))
-                goto error;
         } else {
             virDomainDef *def = vm->newDef ? vm->newDef : vm->def;
             if (!(persistDef = qemuDomainDefCopy(driver, priv->qemuCaps, def,
@@ -5267,7 +5257,6 @@ qemuMigrationSrcResume(virDomainObj *vm,
 static int
 qemuMigrationSrcPerformNative(virQEMUDriver *driver,
                               virDomainObj *vm,
-                              const char *xmlin,
                               const char *persist_xml,
                               const char *uri,
                               const char *cookiein,
@@ -5356,7 +5345,7 @@ qemuMigrationSrcPerformNative(virQEMUDriver *driver,
         ret = qemuMigrationSrcResume(vm, migParams, cookiein, cookieinlen,
                                      cookieout, cookieoutlen, &spec, dconn, flags);
     } else {
-        ret = qemuMigrationSrcRun(driver, vm, xmlin, persist_xml, cookiein, cookieinlen,
+        ret = qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, cookieinlen,
                                   cookieout, cookieoutlen, flags, resource,
                                   &spec, dconn, graphicsuri,
                                   migrate_disks, migrate_disks_detect_zeroes,
@@ -5374,7 +5363,6 @@ static int
 qemuMigrationSrcPerformTunnel(virQEMUDriver *driver,
                               virDomainObj *vm,
                               virStreamPtr st,
-                              const char *xmlin,
                               const char *persist_xml,
                               const char *cookiein,
                               int cookieinlen,
@@ -5422,7 +5410,7 @@ qemuMigrationSrcPerformTunnel(virQEMUDriver *driver,

     /* Migration with NBD is not supported with _TUNNELLED, thus
      * 'migrate_disks_detect_zeroes' is NULL here */
-    ret = qemuMigrationSrcRun(driver, vm, xmlin, persist_xml, cookiein, cookieinlen,
+    ret = qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, cookieinlen,
                               cookieout, cookieoutlen, flags, resource, &spec,
                               dconn, graphicsuri, migrate_disks, NULL,
                               migParams, NULL);
@@ -5461,7 +5449,7 @@ qemuMigrationSrcPerformResume(virQEMUDriver *driver,
     virCloseCallbacksDomainRemove(vm, NULL, qemuMigrationAnyConnectionClosed);
     qemuDomainCleanupRemove(vm, qemuProcessCleanupMigrationJob);

-    ret = qemuMigrationSrcPerformNative(driver, vm, NULL, NULL, uri,
+    ret = qemuMigrationSrcPerformNative(driver, vm, NULL, uri,
                                         cookiein, cookieinlen,
                                         cookieout, cookieoutlen, flags,
                                         0, NULL, NULL, NULL, NULL, migParams, NULL);
@@ -5563,12 +5551,12 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriver *driver,
     VIR_DEBUG("Perform %p", sconn);
     ignore_value(qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_PERFORM2));
     if (flags & VIR_MIGRATE_TUNNELLED)
-        ret = qemuMigrationSrcPerformTunnel(driver, vm, st, NULL, NULL,
+        ret = qemuMigrationSrcPerformTunnel(driver, vm, st, NULL,
                                             NULL, 0, NULL, NULL,
                                             flags, resource, dconn,
                                             NULL, NULL, migParams);
     else
-        ret = qemuMigrationSrcPerformNative(driver, vm, NULL, NULL, uri_out,
+        ret = qemuMigrationSrcPerformNative(driver, vm, NULL, uri_out,
                                             cookie, cookielen,
                                             NULL, NULL, /* No out cookie with v2 migration */
                                             flags, resource, dconn, NULL, NULL,
@@ -5838,14 +5826,14 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriver *driver,
     } else {
         ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3));
         if (flags & VIR_MIGRATE_TUNNELLED) {
-            ret = qemuMigrationSrcPerformTunnel(driver, vm, st, xmlin, persist_xml,
+            ret = qemuMigrationSrcPerformTunnel(driver, vm, st, persist_xml,
                                                 cookiein, cookieinlen,
                                                 &cookieout, &cookieoutlen,
                                                 flags, bandwidth, dconn, graphicsuri,
                                                 migrate_disks,
                                                 migParams);
         } else {
-            ret = qemuMigrationSrcPerformNative(driver, vm, xmlin, persist_xml, uri,
+            ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri,
                                                 cookiein, cookieinlen,
                                                 &cookieout, &cookieoutlen,
                                                 flags, bandwidth, dconn, graphicsuri,
@@ -6243,7 +6231,7 @@ qemuMigrationSrcPerformJob(virQEMUDriver *driver,
         if (qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_PERFORM2) < 0)
             goto endjob;

-        ret = qemuMigrationSrcPerformNative(driver, vm, xmlin, persist_xml, uri, cookiein, cookieinlen,
+        ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen,
                                             cookieout, cookieoutlen,
                                             flags, resource, NULL, NULL, NULL, NULL,
                                             migParams, nbdURI);
@@ -6308,7 +6296,6 @@ static int
 qemuMigrationSrcPerformPhase(virQEMUDriver *driver,
                              virConnectPtr conn,
                              virDomainObj *vm,
-                             const char *xmlin,
                              const char *persist_xml,
                              const char *uri,
                              const char *graphicsuri,
@@ -6346,7 +6333,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *driver,

     virCloseCallbacksDomainRemove(vm, NULL, qemuMigrationAnyConnectionClosed);

-    if (qemuMigrationSrcPerformNative(driver, vm, xmlin, persist_xml, uri, cookiein, cookieinlen,
+    if (qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen,
                                       cookieout, cookieoutlen,
                                       flags, resource, NULL, graphicsuri,
                                       migrate_disks, migrate_disks_detect_zeroes,
@@ -6450,7 +6437,7 @@ qemuMigrationSrcPerform(virQEMUDriver *driver,
     }

     if (v3proto) {
-        return qemuMigrationSrcPerformPhase(driver, conn, vm, xmlin, persist_xml, uri,
+        return qemuMigrationSrcPerformPhase(driver, conn, vm, persist_xml, uri,
                                             graphicsuri,
                                             migrate_disks, migrate_disks_detect_zeroes,
                                             migParams,
-- 
2.47.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux