[PATCH 1/2] qemu: Add support for postcopy-recover-setup migration state

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

 



This patch adds support for recognizing the new migration state reported
by QEMU when post-copy recovery is requested. It is not actually used
for anything yet.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/conf/virdomainjob.c      | 1 +
 src/conf/virdomainjob.h      | 1 +
 src/qemu/qemu_domain.h       | 4 ++++
 src/qemu/qemu_driver.c       | 1 +
 src/qemu/qemu_migration.c    | 7 +++++++
 src/qemu/qemu_monitor.c      | 1 +
 src/qemu/qemu_monitor.h      | 1 +
 src/qemu/qemu_monitor_json.c | 1 +
 src/qemu/qemu_process.c      | 4 ++++
 9 files changed, 21 insertions(+)

diff --git a/src/conf/virdomainjob.c b/src/conf/virdomainjob.c
index 38f08f1d18..2d5a857a8c 100644
--- a/src/conf/virdomainjob.c
+++ b/src/conf/virdomainjob.c
@@ -106,6 +106,7 @@ virDomainJobStatusToType(virDomainJobStatus status)
     case VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED:
     case VIR_DOMAIN_JOB_STATUS_POSTCOPY:
     case VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED:
+    case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER:
     case VIR_DOMAIN_JOB_STATUS_PAUSED:
         return VIR_DOMAIN_JOB_UNBOUNDED;
 
diff --git a/src/conf/virdomainjob.h b/src/conf/virdomainjob.h
index 0d62bab287..8b2dccd298 100644
--- a/src/conf/virdomainjob.h
+++ b/src/conf/virdomainjob.h
@@ -89,6 +89,7 @@ typedef enum {
     VIR_DOMAIN_JOB_STATUS_PAUSED,
     VIR_DOMAIN_JOB_STATUS_POSTCOPY,
     VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED,
+    VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER,
     VIR_DOMAIN_JOB_STATUS_COMPLETED,
     VIR_DOMAIN_JOB_STATUS_FAILED,
     VIR_DOMAIN_JOB_STATUS_CANCELED,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index a5092dd7f0..af0bb04c45 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -199,6 +199,10 @@ struct _qemuDomainObjPrivate {
      * private XML. */
     virBitmap *migrationCaps;
 
+    /* True if QEMU supports "postcopy-recover-setup" migration state. Checked
+     * QEMU enters the state, not to be stored in private XML. */
+    bool migrationRecoverSetup;
+
     /* true if qemu-pr-helper process is running for the domain */
     bool prDaemonRunning;
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 736602333e..3801ad623a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11963,6 +11963,7 @@ qemuDomainGetJobInfoMigrationStats(virDomainObj *vm,
     case VIR_DOMAIN_JOB_STATUS_POSTCOPY:
     case VIR_DOMAIN_JOB_STATUS_PAUSED:
     case VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED:
+    case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER:
         if (qemuMigrationAnyFetchStats(vm, VIR_ASYNC_JOB_NONE,
                                        jobData, NULL) < 0)
             return -1;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 4fd7a0aafb..4f02a9a053 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1802,6 +1802,10 @@ qemuMigrationUpdateJobType(virDomainJobData *jobData)
         jobData->status = VIR_DOMAIN_JOB_STATUS_POSTCOPY;
         break;
 
+    case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP:
+        jobData->status = VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER;
+        break;
+
     case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED:
         jobData->status = VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED;
         break;
@@ -1943,6 +1947,7 @@ qemuMigrationJobCheckStatus(virDomainObj *vm,
     case VIR_DOMAIN_JOB_STATUS_MIGRATING:
     case VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED:
     case VIR_DOMAIN_JOB_STATUS_POSTCOPY:
+    case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER:
     case VIR_DOMAIN_JOB_STATUS_PAUSED:
         break;
     }
@@ -2028,6 +2033,7 @@ qemuMigrationAnyCompleted(virDomainObj *vm,
     case VIR_DOMAIN_JOB_STATUS_MIGRATING:
     case VIR_DOMAIN_JOB_STATUS_POSTCOPY:
     case VIR_DOMAIN_JOB_STATUS_PAUSED:
+    case VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER:
         /* The migration was aborted by us rather than QEMU itself. */
         jobData->status = VIR_DOMAIN_JOB_STATUS_FAILED;
         return -2;
@@ -4669,6 +4675,7 @@ qemuMigrationSrcIsCanceled(virDomainObj *vm)
 
     case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY:
     case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER:
+    case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP:
     case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED:
     case QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER:
     case QEMU_MONITOR_MIGRATION_STATUS_DEVICE:
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index b1c0c6a064..7f65c23748 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -152,6 +152,7 @@ VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
               "postcopy-active",
               "postcopy-paused",
               "postcopy-recover",
+              "postcopy-recover-setup",
               "completed",
               "failed",
               "cancelling",
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 76c859a888..57d1b45bf5 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -762,6 +762,7 @@ typedef enum {
     QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY,
     QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED,
     QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER,
+    QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP,
     QEMU_MONITOR_MIGRATION_STATUS_COMPLETED,
     QEMU_MONITOR_MIGRATION_STATUS_ERROR,
     QEMU_MONITOR_MIGRATION_STATUS_CANCELLING,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 8a20ce57e6..2db38c1007 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2969,6 +2969,7 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValue *reply,
     case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY:
     case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_PAUSED:
     case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER:
+    case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP:
     case QEMU_MONITOR_MIGRATION_STATUS_COMPLETED:
     case QEMU_MONITOR_MIGRATION_STATUS_CANCELLING:
     case QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER:
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index cec739c984..a69878e8bb 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1503,6 +1503,10 @@ qemuProcessHandleMigrationStatus(qemuMonitor *mon G_GNUC_UNUSED,
         }
         break;
 
+    case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP:
+        priv->migrationRecoverSetup = true;
+        break;
+
     case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER:
         if (virDomainObjIsFailedPostcopy(vm, vm->job)) {
             int eventType = -1;
-- 
2.45.2




[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