[GSoC][PATCH 7/7] virmigraiton: `qemuMigrationJobPhase` transformed for more generic use

Prathamesh Chavan pc44800 at gmail.com
Tue Aug 4 14:36:49 UTC 2020


`qemuMigrationJobPhase` was transformed into `virMigrationJobPhase`
and a common util file `virmigration` was created to store its
defination.

Signed-off-by: Prathamesh Chavan <pc44800 at gmail.com>
---
 src/hypervisor/meson.build    |  1 +
 src/hypervisor/virmigration.c | 41 ++++++++++++++++++++
 src/hypervisor/virmigration.h | 38 +++++++++++++++++++
 src/libvirt_private.syms      |  4 ++
 src/qemu/MIGRATION.txt        |  8 ++--
 src/qemu/qemu_domainjob.c     |  4 +-
 src/qemu/qemu_migration.c     | 70 +++++++++++++++++------------------
 src/qemu/qemu_migration.h     | 17 +--------
 src/qemu/qemu_process.c       | 48 ++++++++++++------------
 9 files changed, 150 insertions(+), 81 deletions(-)
 create mode 100644 src/hypervisor/virmigration.c
 create mode 100644 src/hypervisor/virmigration.h

diff --git a/src/hypervisor/meson.build b/src/hypervisor/meson.build
index 85149c683e..c81bdfa2fc 100644
--- a/src/hypervisor/meson.build
+++ b/src/hypervisor/meson.build
@@ -3,6 +3,7 @@ hypervisor_sources = [
   'domain_driver.c',
   'virclosecallbacks.c',
   'virhostdev.c',
+  'virmigration.c',
 ]
 
 hypervisor_lib = static_library(
diff --git a/src/hypervisor/virmigration.c b/src/hypervisor/virmigration.c
new file mode 100644
index 0000000000..2cad5a6b1b
--- /dev/null
+++ b/src/hypervisor/virmigration.c
@@ -0,0 +1,41 @@
+/*
+ * virmigration.c: hypervisor migration handling
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "virmigration.h"
+#include "domain_driver.h"
+#include "virlog.h"
+
+#define VIR_FROM_THIS VIR_FROM_DOMAIN
+
+VIR_LOG_INIT("util.migration");
+
+VIR_ENUM_IMPL(virMigrationJobPhase,
+              VIR_MIGRATION_PHASE_LAST,
+              "none",
+              "perform2",
+              "begin3",
+              "perform3",
+              "perform3_done",
+              "confirm3_cancelled",
+              "confirm3",
+              "prepare",
+              "finish2",
+              "finish3",
+);
diff --git a/src/hypervisor/virmigration.h b/src/hypervisor/virmigration.h
new file mode 100644
index 0000000000..e03d71c1bb
--- /dev/null
+++ b/src/hypervisor/virmigration.h
@@ -0,0 +1,38 @@
+/*
+ * virmigration.h: hypervisor migration handling
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "virenum.h"
+
+
+typedef enum {
+    VIR_MIGRATION_PHASE_NONE = 0,
+    VIR_MIGRATION_PHASE_PERFORM2,
+    VIR_MIGRATION_PHASE_BEGIN3,
+    VIR_MIGRATION_PHASE_PERFORM3,
+    VIR_MIGRATION_PHASE_PERFORM3_DONE,
+    VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED,
+    VIR_MIGRATION_PHASE_CONFIRM3,
+    VIR_MIGRATION_PHASE_PREPARE,
+    VIR_MIGRATION_PHASE_FINISH2,
+    VIR_MIGRATION_PHASE_FINISH3,
+
+    VIR_MIGRATION_PHASE_LAST
+} virMigrationJobPhase;
+VIR_ENUM_DECL(virMigrationJobPhase);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 01c2e710cd..cf78c2f27a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1474,6 +1474,10 @@ virHostdevUpdateActiveSCSIDevices;
 virHostdevUpdateActiveUSBDevices;
 
 
+# hypervisor/virmigration.h
+virMigrationJobPhaseTypeFromString;
+virMigrationJobPhaseTypeToString;
+
 # libvirt_internal.h
 virConnectSupportsFeature;
 virDomainMigrateBegin3;
diff --git a/src/qemu/MIGRATION.txt b/src/qemu/MIGRATION.txt
index e861fd001e..dd044c6064 100644
--- a/src/qemu/MIGRATION.txt
+++ b/src/qemu/MIGRATION.txt
@@ -74,7 +74,7 @@ The sequence of calling qemuMigrationJob* helper methods is as follows:
   migration type and version) has to start migration job and keep it active:
 
       qemuMigrationJobStart(driver, vm, QEMU_JOB_MIGRATION_{IN,OUT});
-      qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_*);
+      qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_*);
       ...do work...
       qemuMigrationJobContinue(vm);
 
@@ -82,7 +82,7 @@ The sequence of calling qemuMigrationJob* helper methods is as follows:
 
       if (!qemuMigrationJobIsActive(vm, QEMU_JOB_MIGRATION_{IN,OUT}))
           return;
-      qemuMigrationJobStartPhase(driver, vm, QEMU_MIGRATION_PHASE_*);
+      qemuMigrationJobStartPhase(driver, vm, VIR_MIGRATION_PHASE_*);
       ...do work...
       qemuMigrationJobContinue(vm);
 
@@ -90,11 +90,11 @@ The sequence of calling qemuMigrationJob* helper methods is as follows:
 
       if (!qemuMigrationJobIsActive(vm, QEMU_JOB_MIGRATION_{IN,OUT}))
           return;
-      qemuMigrationJobStartPhase(driver, vm, QEMU_MIGRATION_PHASE_*);
+      qemuMigrationJobStartPhase(driver, vm, VIR_MIGRATION_PHASE_*);
       ...do work...
       qemuMigrationJobFinish(driver, vm);
 
 While migration job is running (i.e., after qemuMigrationJobStart* but before
 qemuMigrationJob{Continue,Finish}), migration phase can be advanced using
 
-      qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_*);
+      qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_*);
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index ccbb7866b3..5b51aa5416 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -69,7 +69,7 @@ qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
     switch (job) {
     case QEMU_ASYNC_JOB_MIGRATION_OUT:
     case QEMU_ASYNC_JOB_MIGRATION_IN:
-        return qemuMigrationJobPhaseTypeToString(phase);
+        return virMigrationJobPhaseTypeToString(phase);
 
     case QEMU_ASYNC_JOB_SAVE:
     case QEMU_ASYNC_JOB_DUMP:
@@ -95,7 +95,7 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
     switch (job) {
     case QEMU_ASYNC_JOB_MIGRATION_OUT:
     case QEMU_ASYNC_JOB_MIGRATION_IN:
-        return qemuMigrationJobPhaseTypeFromString(phase);
+        return virMigrationJobPhaseTypeFromString(phase);
 
     case QEMU_ASYNC_JOB_SAVE:
     case QEMU_ASYNC_JOB_DUMP:
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 157e023694..38676cc5fa 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -67,8 +67,8 @@
 
 VIR_LOG_INIT("qemu.qemu_migration");
 
-VIR_ENUM_IMPL(qemuMigrationJobPhase,
-              QEMU_MIGRATION_PHASE_LAST,
+VIR_ENUM_IMPL(virMigrationJobPhase,
+              VIR_MIGRATION_PHASE_LAST,
               "none",
               "perform2",
               "begin3",
@@ -89,12 +89,12 @@ qemuMigrationJobStart(virDomainObjPtr vm,
 
 static void
 qemuMigrationJobSetPhase(virDomainObjPtr vm,
-                         qemuMigrationJobPhase phase)
+                         virMigrationJobPhase phase)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 static void
 qemuMigrationJobStartPhase(virDomainObjPtr vm,
-                           qemuMigrationJobPhase phase)
+                           virMigrationJobPhase phase)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 static void
@@ -2002,13 +2002,13 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm,
               " was closed; canceling the migration",
               vm->def->name);
 
-    switch ((qemuMigrationJobPhase) priv->job.phase) {
-    case QEMU_MIGRATION_PHASE_BEGIN3:
+    switch ((virMigrationJobPhase) priv->job.phase) {
+    case VIR_MIGRATION_PHASE_BEGIN3:
         /* just forget we were about to migrate */
         qemuDomainObjDiscardAsyncJob(vm, &priv->job);
         break;
 
-    case QEMU_MIGRATION_PHASE_PERFORM3_DONE:
+    case VIR_MIGRATION_PHASE_PERFORM3_DONE:
         VIR_WARN("Migration of domain %s finished but we don't know if the"
                  " domain was successfully started on destination or not",
                  vm->def->name);
@@ -2018,19 +2018,19 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm,
         qemuDomainObjDiscardAsyncJob(vm, &priv->job);
         break;
 
-    case QEMU_MIGRATION_PHASE_PERFORM3:
+    case VIR_MIGRATION_PHASE_PERFORM3:
         /* cannot be seen without an active migration API; unreachable */
-    case QEMU_MIGRATION_PHASE_CONFIRM3:
-    case QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED:
+    case VIR_MIGRATION_PHASE_CONFIRM3:
+    case VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED:
         /* all done; unreachable */
-    case QEMU_MIGRATION_PHASE_PREPARE:
-    case QEMU_MIGRATION_PHASE_FINISH2:
-    case QEMU_MIGRATION_PHASE_FINISH3:
+    case VIR_MIGRATION_PHASE_PREPARE:
+    case VIR_MIGRATION_PHASE_FINISH2:
+    case VIR_MIGRATION_PHASE_FINISH3:
         /* incoming migration; unreachable */
-    case QEMU_MIGRATION_PHASE_PERFORM2:
+    case VIR_MIGRATION_PHASE_PERFORM2:
         /* single phase outgoing migration; unreachable */
-    case QEMU_MIGRATION_PHASE_NONE:
-    case QEMU_MIGRATION_PHASE_LAST:
+    case VIR_MIGRATION_PHASE_NONE:
+    case VIR_MIGRATION_PHASE_LAST:
         /* unreachable */
         ;
     }
@@ -2066,7 +2066,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver,
      * change protection.
      */
     if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT)
-        qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_BEGIN3);
+        qemuMigrationJobSetPhase(vm, VIR_MIGRATION_PHASE_BEGIN3);
 
     if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags))
         return NULL;
@@ -2525,7 +2525,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
 
     if (qemuMigrationJobStart(vm, QEMU_ASYNC_JOB_MIGRATION_IN, flags) < 0)
         goto cleanup;
-    qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PREPARE);
+    qemuMigrationJobSetPhase(vm, VIR_MIGRATION_PHASE_PREPARE);
 
     /* Domain starts inactive, even if the domain XML had an id field. */
     vm->def->id = -1;
@@ -2987,8 +2987,8 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
     virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
 
     qemuMigrationJobSetPhase(vm, retcode == 0
-                             ? QEMU_MIGRATION_PHASE_CONFIRM3
-                             : QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED);
+                             ? VIR_MIGRATION_PHASE_CONFIRM3
+                             : VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED);
 
     if (!(mig = qemuMigrationEatCookie(driver, vm->def, priv->origname, priv,
                                        cookiein, cookieinlen,
@@ -3077,7 +3077,7 @@ qemuMigrationSrcConfirm(virQEMUDriverPtr driver,
                         unsigned int flags,
                         int cancelled)
 {
-    qemuMigrationJobPhase phase;
+    virMigrationJobPhase phase;
     virQEMUDriverConfigPtr cfg = NULL;
     int ret = -1;
 
@@ -3087,9 +3087,9 @@ qemuMigrationSrcConfirm(virQEMUDriverPtr driver,
         goto cleanup;
 
     if (cancelled)
-        phase = QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED;
+        phase = VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED;
     else
-        phase = QEMU_MIGRATION_PHASE_CONFIRM3;
+        phase = VIR_MIGRATION_PHASE_CONFIRM3;
 
     qemuMigrationJobStartPhase(vm, phase);
     virCloseCallbacksUnset(driver->closeCallbacks, vm,
@@ -4031,7 +4031,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
      * until the migration is complete.
      */
     VIR_DEBUG("Perform %p", sconn);
-    qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM2);
+    qemuMigrationJobSetPhase(vm, VIR_MIGRATION_PHASE_PERFORM2);
     if (flags & VIR_MIGRATE_TUNNELLED)
         ret = qemuMigrationSrcPerformTunnel(driver, vm, st, NULL,
                                             NULL, 0, NULL, NULL,
@@ -4269,7 +4269,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
      * confirm migration completion.
      */
     VIR_DEBUG("Perform3 %p uri=%s", sconn, NULLSTR(uri));
-    qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3);
+    qemuMigrationJobSetPhase(vm, VIR_MIGRATION_PHASE_PERFORM3);
     VIR_FREE(cookiein);
     cookiein = g_steal_pointer(&cookieout);
     cookieinlen = cookieoutlen;
@@ -4294,7 +4294,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
     if (ret < 0) {
         virErrorPreserveLast(&orig_err);
     } else {
-        qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE);
+        qemuMigrationJobSetPhase(vm, VIR_MIGRATION_PHASE_PERFORM3_DONE);
     }
 
     /* If Perform returns < 0, then we need to cancel the VM
@@ -4657,7 +4657,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
                                                migParams, flags, dname, resource,
                                                &v3proto);
     } else {
-        qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM2);
+        qemuMigrationJobSetPhase(vm, VIR_MIGRATION_PHASE_PERFORM2);
         ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen,
                                             cookieout, cookieoutlen,
                                             flags, resource, NULL, NULL, 0, NULL,
@@ -4742,7 +4742,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
         return ret;
     }
 
-    qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3);
+    qemuMigrationJobStartPhase(vm, VIR_MIGRATION_PHASE_PERFORM3);
     virCloseCallbacksUnset(driver->closeCallbacks, vm,
                            qemuMigrationSrcCleanup);
 
@@ -4756,7 +4756,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
         goto endjob;
     }
 
-    qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE);
+    qemuMigrationJobSetPhase(vm, VIR_MIGRATION_PHASE_PERFORM3_DONE);
 
     if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn,
                              qemuMigrationSrcCleanup) < 0)
@@ -4989,8 +4989,8 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver,
     ignore_value(virTimeMillisNow(&timeReceived));
 
     qemuMigrationJobStartPhase(vm,
-                               v3proto ? QEMU_MIGRATION_PHASE_FINISH3
-                                       : QEMU_MIGRATION_PHASE_FINISH2);
+                               v3proto ? VIR_MIGRATION_PHASE_FINISH3
+                                       : VIR_MIGRATION_PHASE_FINISH2);
 
     qemuDomainCleanupRemove(vm, qemuMigrationDstPrepareCleanup);
     g_clear_pointer(&jobPriv->completed, qemuDomainJobInfoFree);
@@ -5464,14 +5464,14 @@ qemuMigrationJobStart(virDomainObjPtr vm,
 
 static void
 qemuMigrationJobSetPhase(virDomainObjPtr vm,
-                         qemuMigrationJobPhase phase)
+                         virMigrationJobPhase phase)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
     if (phase < priv->job.phase) {
         VIR_ERROR(_("migration protocol going backwards %s => %s"),
-                  qemuMigrationJobPhaseTypeToString(priv->job.phase),
-                  qemuMigrationJobPhaseTypeToString(phase));
+                  virMigrationJobPhaseTypeToString(priv->job.phase),
+                  virMigrationJobPhaseTypeToString(phase));
         return;
     }
 
@@ -5480,7 +5480,7 @@ qemuMigrationJobSetPhase(virDomainObjPtr vm,
 
 static void
 qemuMigrationJobStartPhase(virDomainObjPtr vm,
-                           qemuMigrationJobPhase phase)
+                           virMigrationJobPhase phase)
 {
     qemuMigrationJobSetPhase(vm, phase);
 }
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index e99351ef82..8f5e2d0f81 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -24,6 +24,7 @@
 #include "qemu_conf.h"
 #include "qemu_domain.h"
 #include "qemu_migration_params.h"
+#include "virmigration.h"
 #include "virenum.h"
 
 /*
@@ -87,22 +88,6 @@
     NULL
 
 
-typedef enum {
-    QEMU_MIGRATION_PHASE_NONE = 0,
-    QEMU_MIGRATION_PHASE_PERFORM2,
-    QEMU_MIGRATION_PHASE_BEGIN3,
-    QEMU_MIGRATION_PHASE_PERFORM3,
-    QEMU_MIGRATION_PHASE_PERFORM3_DONE,
-    QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED,
-    QEMU_MIGRATION_PHASE_CONFIRM3,
-    QEMU_MIGRATION_PHASE_PREPARE,
-    QEMU_MIGRATION_PHASE_FINISH2,
-    QEMU_MIGRATION_PHASE_FINISH3,
-
-    QEMU_MIGRATION_PHASE_LAST
-} qemuMigrationJobPhase;
-VIR_ENUM_DECL(qemuMigrationJobPhase);
-
 char *
 qemuMigrationSrcBegin(virConnectPtr conn,
                       virDomainObjPtr vm,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ed34956a97..34631e3464 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3429,24 +3429,24 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
                     (state == VIR_DOMAIN_RUNNING &&
                      reason == VIR_DOMAIN_RUNNING_POSTCOPY);
 
-    switch ((qemuMigrationJobPhase) job->phase) {
-    case QEMU_MIGRATION_PHASE_NONE:
-    case QEMU_MIGRATION_PHASE_PERFORM2:
-    case QEMU_MIGRATION_PHASE_BEGIN3:
-    case QEMU_MIGRATION_PHASE_PERFORM3:
-    case QEMU_MIGRATION_PHASE_PERFORM3_DONE:
-    case QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED:
-    case QEMU_MIGRATION_PHASE_CONFIRM3:
-    case QEMU_MIGRATION_PHASE_LAST:
+    switch ((virMigrationJobPhase) job->phase) {
+    case VIR_MIGRATION_PHASE_NONE:
+    case VIR_MIGRATION_PHASE_PERFORM2:
+    case VIR_MIGRATION_PHASE_BEGIN3:
+    case VIR_MIGRATION_PHASE_PERFORM3:
+    case VIR_MIGRATION_PHASE_PERFORM3_DONE:
+    case VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED:
+    case VIR_MIGRATION_PHASE_CONFIRM3:
+    case VIR_MIGRATION_PHASE_LAST:
         /* N/A for incoming migration */
         break;
 
-    case QEMU_MIGRATION_PHASE_PREPARE:
+    case VIR_MIGRATION_PHASE_PREPARE:
         VIR_DEBUG("Killing unfinished incoming migration for domain %s",
                   vm->def->name);
         return -1;
 
-    case QEMU_MIGRATION_PHASE_FINISH2:
+    case VIR_MIGRATION_PHASE_FINISH2:
         /* source domain is already killed so let's just resume the domain
          * and hope we are all set */
         VIR_DEBUG("Incoming migration finished, resuming domain %s",
@@ -3458,7 +3458,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
         }
         break;
 
-    case QEMU_MIGRATION_PHASE_FINISH3:
+    case VIR_MIGRATION_PHASE_FINISH3:
         /* migration finished, we started resuming the domain but didn't
          * confirm success or failure yet; killing it seems safest unless
          * we already started guest CPUs or we were in post-copy mode */
@@ -3490,22 +3490,22 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
                      reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED);
     bool resume = false;
 
-    switch ((qemuMigrationJobPhase) job->phase) {
-    case QEMU_MIGRATION_PHASE_NONE:
-    case QEMU_MIGRATION_PHASE_PREPARE:
-    case QEMU_MIGRATION_PHASE_FINISH2:
-    case QEMU_MIGRATION_PHASE_FINISH3:
-    case QEMU_MIGRATION_PHASE_LAST:
+    switch ((virMigrationJobPhase) job->phase) {
+    case VIR_MIGRATION_PHASE_NONE:
+    case VIR_MIGRATION_PHASE_PREPARE:
+    case VIR_MIGRATION_PHASE_FINISH2:
+    case VIR_MIGRATION_PHASE_FINISH3:
+    case VIR_MIGRATION_PHASE_LAST:
         /* N/A for outgoing migration */
         break;
 
-    case QEMU_MIGRATION_PHASE_BEGIN3:
+    case VIR_MIGRATION_PHASE_BEGIN3:
         /* nothing happened so far, just forget we were about to migrate the
          * domain */
         break;
 
-    case QEMU_MIGRATION_PHASE_PERFORM2:
-    case QEMU_MIGRATION_PHASE_PERFORM3:
+    case VIR_MIGRATION_PHASE_PERFORM2:
+    case VIR_MIGRATION_PHASE_PERFORM3:
         /* migration is still in progress, let's cancel it and resume the
          * domain; however we can only do that before migration enters
          * post-copy mode
@@ -3523,7 +3523,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
         }
         break;
 
-    case QEMU_MIGRATION_PHASE_PERFORM3_DONE:
+    case VIR_MIGRATION_PHASE_PERFORM3_DONE:
         /* migration finished but we didn't have a chance to get the result
          * of Finish3 step; third party needs to check what to do next; in
          * post-copy mode we can use PAUSED_POSTCOPY_FAILED state for this
@@ -3532,7 +3532,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
             qemuMigrationAnyPostcopyFailed(driver, vm);
         break;
 
-    case QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED:
+    case VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED:
         /* Finish3 failed, we need to resume the domain, but once we enter
          * post-copy mode there's no way back, so let's just mark the domain
          * as broken in that case
@@ -3546,7 +3546,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
         }
         break;
 
-    case QEMU_MIGRATION_PHASE_CONFIRM3:
+    case VIR_MIGRATION_PHASE_CONFIRM3:
         /* migration completed, we need to kill the domain here */
         *stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
         return -1;
-- 
2.25.1




More information about the libvir-list mailing list