[PATCH v2 11/12] qemu: introduce QEMU_DOMAIN_JOB_STATUS_PREPARE

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

 



This patch removes the last place where we consult
priv->job.current->stats.status for migration state, namely
in qemuDomainGetMigrationJobStats.
---
 src/qemu/qemu_domain.c    | 1 +
 src/qemu/qemu_domain.h    | 1 +
 src/qemu/qemu_driver.c    | 5 +++--
 src/qemu/qemu_migration.c | 7 +++++--
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 952a933..74ceab9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -392,6 +392,7 @@ qemuDomainJobStatusToType(qemuDomainJobStatus status)
     switch (status) {
     case QEMU_DOMAIN_JOB_STATUS_NONE:
         return VIR_DOMAIN_JOB_NONE;
+    case QEMU_DOMAIN_JOB_STATUS_PREPARE:
     case QEMU_DOMAIN_JOB_STATUS_ACTIVE:
     case QEMU_DOMAIN_JOB_STATUS_POSTCOPY:
         return VIR_DOMAIN_JOB_UNBOUNDED;
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 273145d..d001ae6 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -100,6 +100,7 @@ VIR_ENUM_DECL(qemuDomainAsyncJob)
 
 typedef enum {
     QEMU_DOMAIN_JOB_STATUS_NONE = 0,
+    QEMU_DOMAIN_JOB_STATUS_PREPARE,
     QEMU_DOMAIN_JOB_STATUS_ACTIVE,
     QEMU_DOMAIN_JOB_STATUS_COMPLETED,
     QEMU_DOMAIN_JOB_STATUS_POSTCOPY,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index acaad8f..0d2f9de 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13019,12 +13019,13 @@ qemuDomainGetMigrationJobStats(virQEMUDriverPtr driver,
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
-    if (jobInfo->status != QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
+    if (jobInfo->status != QEMU_DOMAIN_JOB_STATUS_PREPARE &&
+        jobInfo->status != QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
         jobInfo->status != QEMU_DOMAIN_JOB_STATUS_POSTCOPY)
         return 0;
 
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT) &&
-        priv->job.current->stats.status) {
+        jobInfo->status != QEMU_DOMAIN_JOB_STATUS_PREPARE) {
         int rv;
 
         qemuDomainObjEnterMonitor(driver, vm);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 5be79df..b26b8ad 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2641,6 +2641,7 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
         return -1;
 
     case QEMU_DOMAIN_JOB_STATUS_COMPLETED:
+    case QEMU_DOMAIN_JOB_STATUS_PREPARE:
     case QEMU_DOMAIN_JOB_STATUS_ACTIVE:
     case QEMU_DOMAIN_JOB_STATUS_POSTCOPY:
         break;
@@ -4869,7 +4870,8 @@ qemuMigrationRun(virQEMUDriverPtr driver,
         ignore_value(virTimeMillisNow(&priv->job.completed->sent));
     }
 
-    if (priv->job.current->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE)
+    if (priv->job.current->status == QEMU_DOMAIN_JOB_STATUS_PREPARE ||
+        priv->job.current->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE)
         priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_FAILED;
 
     cookieFlags |= QEMU_MIGRATION_COOKIE_NETWORK |
@@ -6615,13 +6617,14 @@ qemuMigrationJobStart(virQEMUDriverPtr driver,
 
     if (job == QEMU_ASYNC_JOB_MIGRATION_IN) {
         qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_NONE);
+        priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
     } else {
         qemuDomainObjSetAsyncJobMask(vm, (QEMU_JOB_DEFAULT_MASK |
                                           JOB_MASK(QEMU_JOB_SUSPEND) |
                                           JOB_MASK(QEMU_JOB_MIGRATION_OP)));
+        priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_PREPARE;
     }
 
-    priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
 
     return 0;
 }
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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