[PATCH v2 40/73] qemu: Call qemuMigrationAnyCompressionParse only from driver

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

 



Propagate the calls up the stack to the point where
qemuMigrationParamsFromFlags is called. The end goal achieved in the
following few patches is to merge compression parameters into the
general migration parameters code.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c    | 21 ++++++++++++++++++---
 src/qemu/qemu_migration.c | 25 +++++++------------------
 src/qemu/qemu_migration.h |  1 +
 3 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5271e01d92..85755257aa 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12126,6 +12126,7 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
     virQEMUDriverPtr driver = dconn->privateData;
     virDomainDefPtr def = NULL;
     char *origname = NULL;
+    qemuMigrationCompressionPtr compression = NULL;
     qemuMigrationParamsPtr migParams = NULL;
     int ret = -1;
 
@@ -12137,6 +12138,9 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
         goto cleanup;
     }
 
+    if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
+        goto cleanup;
+
     if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
                                                    QEMU_MIGRATION_DESTINATION)))
         goto cleanup;
@@ -12156,9 +12160,10 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
 
     ret = qemuMigrationDstPrepareTunnel(driver, dconn,
                                         NULL, 0, NULL, NULL, /* No cookies in v2 */
-                                        st, &def, origname, migParams, flags);
+                                        st, &def, origname, compression, migParams, flags);
 
  cleanup:
+    VIR_FREE(compression);
     qemuMigrationParamsFree(migParams);
     VIR_FREE(origname);
     virDomainDefFree(def);
@@ -12597,6 +12602,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
     virQEMUDriverPtr driver = dconn->privateData;
     virDomainDefPtr def = NULL;
     char *origname = NULL;
+    qemuMigrationCompressionPtr compression = NULL;
     qemuMigrationParamsPtr migParams = NULL;
     int ret = -1;
 
@@ -12608,6 +12614,9 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
         goto cleanup;
     }
 
+    if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
+        goto cleanup;
+
     if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
                                                    QEMU_MIGRATION_DESTINATION)))
         goto cleanup;
@@ -12621,9 +12630,10 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
     ret = qemuMigrationDstPrepareTunnel(driver, dconn,
                                         cookiein, cookieinlen,
                                         cookieout, cookieoutlen,
-                                        st, &def, origname, migParams, flags);
+                                        st, &def, origname, compression, migParams, flags);
 
  cleanup:
+    VIR_FREE(compression);
     qemuMigrationParamsFree(migParams);
     VIR_FREE(origname);
     virDomainDefFree(def);
@@ -12646,6 +12656,7 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
     const char *dom_xml = NULL;
     const char *dname = NULL;
     char *origname = NULL;
+    qemuMigrationCompressionPtr compression = NULL;
     qemuMigrationParamsPtr migParams = NULL;
     int ret = -1;
 
@@ -12667,6 +12678,9 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
         goto cleanup;
     }
 
+    if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
+        goto cleanup;
+
     if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
                                                    QEMU_MIGRATION_DESTINATION)))
         goto cleanup;
@@ -12680,9 +12694,10 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
     ret = qemuMigrationDstPrepareTunnel(driver, dconn,
                                         cookiein, cookieinlen,
                                         cookieout, cookieoutlen,
-                                        st, &def, origname, migParams, flags);
+                                        st, &def, origname, compression, migParams, flags);
 
  cleanup:
+    VIR_FREE(compression);
     qemuMigrationParamsFree(migParams);
     VIR_FREE(origname);
     virDomainDefFree(def);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index e1a29d9569..d4c5994f25 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2531,12 +2531,10 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
                               virStreamPtr st,
                               virDomainDefPtr *def,
                               const char *origname,
+                              qemuMigrationCompressionPtr compression,
                               qemuMigrationParamsPtr migParams,
                               unsigned long flags)
 {
-    qemuMigrationCompressionPtr compression = NULL;
-    int ret;
-
     VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, "
               "cookieout=%p, cookieoutlen=%p, st=%p, def=%p, "
               "origname=%s, flags=0x%lx",
@@ -2549,15 +2547,10 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
         return -1;
     }
 
-    if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
-        return -1;
-
-    ret = qemuMigrationDstPrepareAny(driver, dconn, cookiein, cookieinlen,
-                                     cookieout, cookieoutlen, def, origname,
-                                     st, NULL, 0, false, NULL, 0, NULL, 0,
-                                     compression, migParams, flags);
-    VIR_FREE(compression);
-    return ret;
+    return qemuMigrationDstPrepareAny(driver, dconn, cookiein, cookieinlen,
+                                      cookieout, cookieoutlen, def, origname,
+                                      st, NULL, 0, false, NULL, 0, NULL, 0,
+                                      compression, migParams, flags);
 }
 
 
@@ -3759,6 +3752,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
                                   unsigned long flags,
                                   const char *dname,
                                   unsigned long resource,
+                                  qemuMigrationCompressionPtr compression,
                                   qemuMigrationParamsPtr migParams)
 {
     virDomainPtr ddomain = NULL;
@@ -3770,7 +3764,6 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
     bool cancelled;
     virStreamPtr st = NULL;
     unsigned long destflags;
-    qemuMigrationCompressionPtr compression = NULL;
 
     VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, "
               "flags=0x%lx, dname=%s, resource=%lu",
@@ -3792,9 +3785,6 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
     destflags = flags & ~(VIR_MIGRATE_ABORT_ON_ERROR |
                           VIR_MIGRATE_AUTO_CONVERGE);
 
-    if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
-        goto cleanup;
-
     VIR_DEBUG("Prepare2 %p", dconn);
     if (flags & VIR_MIGRATE_TUNNELLED) {
         /*
@@ -3895,7 +3885,6 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
     }
     VIR_FREE(uri_out);
     VIR_FREE(cookie);
-    VIR_FREE(compression);
 
     return ret;
 }
@@ -4409,7 +4398,7 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr driver,
     } else {
         ret = qemuMigrationSrcPerformPeer2Peer2(driver, sconn, dconn, vm,
                                                 dconnuri, flags, dname, resource,
-                                                migParams);
+                                                compression, migParams);
     }
 
  cleanup:
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 2bf710a919..3cd456568a 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -148,6 +148,7 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
                               virStreamPtr st,
                               virDomainDefPtr *def,
                               const char *origname,
+                              qemuMigrationCompressionPtr compression,
                               qemuMigrationParamsPtr migParams,
                               unsigned long flags);
 
-- 
2.17.0

--
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