[libvirt] [PATCH v2 70/73] qemu: Drop priv->job.postcopyEnabled bool

Jiri Denemark jdenemar at redhat.com
Wed Apr 11 14:42:00 UTC 2018


We store the flags passed to the API which started the migration. Let's
use them instead of a separate bool to check if post-copy migration was
requested.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_domain.c    | 1 -
 src/qemu/qemu_domain.h    | 1 -
 src/qemu/qemu_driver.c    | 2 +-
 src/qemu/qemu_migration.c | 4 ----
 4 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9343f41f57..71c3a917c1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -332,7 +332,6 @@ qemuDomainObjResetAsyncJob(qemuDomainObjPrivatePtr priv)
     job->abortJob = false;
     job->spiceMigration = false;
     job->spiceMigrated = false;
-    job->postcopyEnabled = false;
     job->dumpCompleted = false;
     VIR_FREE(job->error);
     VIR_FREE(job->current);
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 8d608da121..91385da2a9 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -176,7 +176,6 @@ struct _qemuDomainJobObj {
     bool spiceMigration;                /* we asked for spice migration and we
                                          * should wait for it to finish */
     bool spiceMigrated;                 /* spice migration completed */
-    bool postcopyEnabled;               /* post-copy migration was enabled */
     char *error;                        /* job event completion error */
     bool dumpCompleted;                 /* dump completed */
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3fac038583..1b37c0b45a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13840,7 +13840,7 @@ qemuDomainMigrateStartPostCopy(virDomainPtr dom,
         goto endjob;
     }
 
-    if (!priv->job.postcopyEnabled) {
+    if (!(priv->job.apiFlags & VIR_MIGRATE_POSTCOPY)) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("switching to post-copy requires migration to be "
                          "started with VIR_MIGRATE_POSTCOPY flag"));
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 431875c762..ad87aebd3b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2406,8 +2406,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
                                  migParams) < 0)
         goto stopjob;
 
-    priv->job.postcopyEnabled = flags & VIR_MIGRATE_POSTCOPY;
-
     if (mig->nbd &&
         flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC) &&
         virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NBD_SERVER)) {
@@ -3346,8 +3344,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
                                  migParams) < 0)
         goto error;
 
-    priv->job.postcopyEnabled = flags & VIR_MIGRATE_POSTCOPY;
-
     if (migrate_flags & (QEMU_MONITOR_MIGRATE_NON_SHARED_DISK |
                          QEMU_MONITOR_MIGRATE_NON_SHARED_INC)) {
         if (mig->nbd) {
-- 
2.17.0




More information about the libvir-list mailing list