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

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



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

This is one of the initial steps we are taking towards making
more and more code hypervisor agnostic. And this shall
be followed by transformation of similar structs in the future.

Signed-off-by: Prathamesh Chavan <pc44800 gmail com>
---
Previous version of this patch can be found here[1].

After recent addition of `qemu_snapshot` files, I thought
about updating the patch on the new master so that
checking it out will be easier.

[1]: https://www.redhat.com/archives/libvir-list/2020-August/msg00743.html

 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     | 74 +++++++++++++++++------------------
 src/qemu/qemu_migration.h     | 17 +-------
 src/qemu/qemu_process.c       | 48 +++++++++++------------
 9 files changed, 151 insertions(+), 84 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 f950a68179..c7adf16aba 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1477,6 +1477,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 eeaa089959..02f85e1b13 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -70,7 +70,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:
@@ -96,7 +96,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 142faa2cf9..a6f1da97bd 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",
@@ -91,13 +91,13 @@ qemuMigrationJobStart(virQEMUDriverPtr driver,
 static void
 qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
                          virDomainObjPtr vm,
-                         qemuMigrationJobPhase phase)
+                         virMigrationJobPhase phase)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 static void
 qemuMigrationJobStartPhase(virQEMUDriverPtr driver,
                            virDomainObjPtr vm,
-                           qemuMigrationJobPhase phase)
+                           virMigrationJobPhase phase)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 static void
@@ -2023,13 +2023,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(driver, vm);
         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);
@@ -2039,19 +2039,19 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm,
         qemuDomainObjDiscardAsyncJob(driver, vm);
         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 */
         ;
     }
@@ -2087,7 +2087,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver,
      * change protection.
      */
     if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT)
-        qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_BEGIN3);
+        qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_BEGIN3);
 
     if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags))
         return NULL;
@@ -2546,7 +2546,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
     if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN,
                               flags) < 0)
         goto cleanup;
-    qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PREPARE);
+    qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PREPARE);
 
     /* Domain starts inactive, even if the domain XML had an id field. */
     vm->def->id = -1;
@@ -3007,10 +3007,9 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
 
     virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
 
-    qemuMigrationJobSetPhase(driver, vm,
-                             retcode == 0
-                             ? QEMU_MIGRATION_PHASE_CONFIRM3
-                             : QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED);
+    qemuMigrationJobSetPhase(driver, vm, retcode == 0
+                             ? VIR_MIGRATION_PHASE_CONFIRM3
+                             : VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED);
 
     if (!(mig = qemuMigrationEatCookie(driver, vm->def, priv->origname, priv,
                                        cookiein, cookieinlen,
@@ -3100,7 +3099,7 @@ qemuMigrationSrcConfirm(virQEMUDriverPtr driver,
                         unsigned int flags,
                         int cancelled)
 {
-    qemuMigrationJobPhase phase;
+    virMigrationJobPhase phase;
     virQEMUDriverConfigPtr cfg = NULL;
     int ret = -1;
 
@@ -3110,9 +3109,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(driver, vm, phase);
     virCloseCallbacksUnset(driver->closeCallbacks, vm,
@@ -4059,7 +4058,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
      * until the migration is complete.
      */
     VIR_DEBUG("Perform %p", sconn);
-    qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM2);
+    qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM2);
     if (flags & VIR_MIGRATE_TUNNELLED)
         ret = qemuMigrationSrcPerformTunnel(driver, vm, st, NULL,
                                             NULL, 0, NULL, NULL,
@@ -4297,7 +4296,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
      * confirm migration completion.
      */
     VIR_DEBUG("Perform3 %p uri=%s", sconn, NULLSTR(uri));
-    qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3);
+    qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM3);
     VIR_FREE(cookiein);
     cookiein = g_steal_pointer(&cookieout);
     cookieinlen = cookieoutlen;
@@ -4322,8 +4321,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
     if (ret < 0) {
         virErrorPreserveLast(&orig_err);
     } else {
-        qemuMigrationJobSetPhase(driver, vm,
-                                 QEMU_MIGRATION_PHASE_PERFORM3_DONE);
+        qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM3_DONE);
     }
 
     /* If Perform returns < 0, then we need to cancel the VM
@@ -4687,7 +4685,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
                                                migParams, flags, dname, resource,
                                                &v3proto);
     } else {
-        qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM2);
+        qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM2);
         ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen,
                                             cookieout, cookieoutlen,
                                             flags, resource, NULL, NULL, 0, NULL,
@@ -4772,7 +4770,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
         return ret;
     }
 
-    qemuMigrationJobStartPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3);
+    qemuMigrationJobStartPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM3);
     virCloseCallbacksUnset(driver->closeCallbacks, vm,
                            qemuMigrationSrcCleanup);
 
@@ -4786,7 +4784,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
         goto endjob;
     }
 
-    qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE);
+    qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM3_DONE);
 
     if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn,
                              qemuMigrationSrcCleanup) < 0)
@@ -5019,8 +5017,8 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver,
     ignore_value(virTimeMillisNow(&timeReceived));
 
     qemuMigrationJobStartPhase(driver, 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(&priv->job.completed, qemuDomainJobInfoFree);
@@ -5498,14 +5496,14 @@ qemuMigrationJobStart(virQEMUDriverPtr driver,
 static void
 qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
                          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;
     }
 
@@ -5515,7 +5513,7 @@ qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
 static void
 qemuMigrationJobStartPhase(virQEMUDriverPtr driver,
                            virDomainObjPtr vm,
-                           qemuMigrationJobPhase phase)
+                           virMigrationJobPhase phase)
 {
     qemuMigrationJobSetPhase(driver, vm, phase);
 }
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index b6f88d3fd9..b05f5254b4 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 ad461d8f34..55b31382f3 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3434,24 +3434,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",
@@ -3463,7 +3463,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 */
@@ -3495,22 +3495,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
@@ -3528,7 +3528,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
@@ -3537,7 +3537,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
@@ -3551,7 +3551,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


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