[libvirt PATCH v2 44/81] qemu: Separate protocol checks from qemuMigrationJobSetPhase

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

 



Into a new qemuMigrationCheckPhase helper, which can be reused in other
places.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>
Reviewed-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---

Notes:
    Version 2:
    - no change

 src/qemu/qemu_migration.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 710aae3eb7..edd3ac2a87 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -139,9 +139,9 @@ qemuMigrationJobStart(virQEMUDriver *driver,
 }
 
 
-static void ATTRIBUTE_NONNULL(1)
-qemuMigrationJobSetPhase(virDomainObj *vm,
-                         qemuMigrationJobPhase phase)
+static int
+qemuMigrationCheckPhase(virDomainObj *vm,
+                        qemuMigrationJobPhase phase)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
 
@@ -150,9 +150,20 @@ qemuMigrationJobSetPhase(virDomainObj *vm,
         VIR_ERROR(_("migration protocol going backwards %s => %s"),
                   qemuMigrationJobPhaseTypeToString(priv->job.phase),
                   qemuMigrationJobPhaseTypeToString(phase));
-        return;
+        return -1;
     }
 
+    return 0;
+}
+
+
+static void ATTRIBUTE_NONNULL(1)
+qemuMigrationJobSetPhase(virDomainObj *vm,
+                         qemuMigrationJobPhase phase)
+{
+    if (qemuMigrationCheckPhase(vm, phase) < 0)
+        return;
+
     qemuDomainObjSetJobPhase(vm, phase);
 }
 
-- 
2.35.1




[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