[libvirt] [PATCH 5/7] qemu: Don't report false errors in migration protocol v2

Jiri Denemark jdenemar at redhat.com
Wed Jul 8 17:36:04 UTC 2015


Finish is the final state in v2 of our migration protocol. If something
fails, we have no option to abort the migration and resume the original
domain. Non fatal errors (such as failure to start guest CPUs or make
the domain persistent) has to be treated as success. Keeping the domain
running while reporting the failure was just asking for troubles.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_migration.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 576b32d..bca5ad1 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5589,7 +5589,6 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     unsigned short port;
-    bool keep = false;
 
     VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
               "cookieout=%p, cookieoutlen=%p, flags=%lx, retcode=%d",
@@ -5667,21 +5666,17 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
                  * other hand, if we report failure, then the management tools
                  * might try to restart the domain on the source side, even
                  * though the domain is actually running on the destination.
-                 * Return a NULL dom pointer, and hope that this is a rare
-                 * situation and management tools are smart.
-                 */
-
-                /*
+                 * Pretend success and hope that this is a rare situation and
+                 * management tools are smart.
+                 *
                  * However, in v3 protocol, the source VM is still available
                  * to restart during confirm() step, so we kill it off now.
                  */
                 if (v3proto) {
                     if (newVM)
                         vm->persistent = 0;
-                } else {
-                    keep = true;
+                    goto endjob;
                 }
-                goto endjob;
             }
         }
 
@@ -5709,9 +5704,8 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
                  * target in paused state, in case admin can fix
                  * things up
                  */
-                if (!v3proto)
-                    keep = true;
-                goto endjob;
+                if (v3proto)
+                    goto endjob;
             }
             if (priv->job.completed) {
                 qemuDomainJobInfoUpdateTime(priv->job.completed);
@@ -5752,7 +5746,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
     }
 
  endjob:
-    if (!dom && !keep &&
+    if (!dom &&
         !(flags & VIR_MIGRATE_OFFLINE) &&
         virDomainObjIsActive(vm)) {
         qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
-- 
2.4.5




More information about the libvir-list mailing list