Into a new qemuMigrationCheckPhase helper, which can be reused in other
places.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
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 301d9db1d2..5b6073b963 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