[PATCH 3/7] qemu: migration: Aggregate logic depending on tunnelled migration

Peter Krempa pkrempa at redhat.com
Tue Nov 24 13:58:58 UTC 2020


Move and aggregate all the logic which is switched based on whether the
migration is tunnelled or not before other checks. Further checks will
be added later.

While the code is being moved the error message is put on a single line
per new coding style.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_migration.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 85f3c4ccee..13d73638f4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2219,6 +2219,17 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver,
     }

     if (flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC)) {
+        if (flags & VIR_MIGRATE_TUNNELLED) {
+            if (nmigrate_disks) {
+                virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                               _("Selecting disks to migrate is not implemented for tunnelled migration"));
+                return NULL;
+            }
+        } else {
+            cookieFlags |= QEMU_MIGRATION_COOKIE_NBD;
+            priv->nbdPort = 0;
+        }
+
         if (nmigrate_disks) {
             size_t i, j;
             /* Check user requested only known disk targets. */
@@ -2235,18 +2246,6 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver,
                     return NULL;
                 }
             }
-
-            if (flags & VIR_MIGRATE_TUNNELLED) {
-                virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
-                               _("Selecting disks to migrate is not "
-                                 "implemented for tunnelled migration"));
-                return NULL;
-            }
-        }
-
-        if (!(flags & VIR_MIGRATE_TUNNELLED)) {
-            cookieFlags |= QEMU_MIGRATION_COOKIE_NBD;
-            priv->nbdPort = 0;
         }
     }

-- 
2.28.0




More information about the libvir-list mailing list