From 8ab12f1a5b4834b29ed99b8c6628a6a2843fa719 Mon Sep 17 00:00:00 2001 From: Xing Lin Date: Thu, 9 Apr 2015 16:02:02 -0600 Subject: [PATCH] qemu_migration.c: sleep first before checking for migration status. The problem with the previous implementation is, even when qemuMigrationUpdateJobStatus() detects a migration job has completed, it will do a sleep for 50 ms (which is unnecessary and only adds up to the VM pause time). Signed-off-by: Xing Lin Signed-off-by: Michal Privoznik (cherry picked from commit 522e81cbb501e9772fbafba975ac886c1b4a283d) --- src/qemu/qemu_migration.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 5daf12f38f..9fa58cada1 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2369,7 +2369,7 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, jobInfo->type = VIR_DOMAIN_JOB_UNBOUNDED; - while (jobInfo->type == VIR_DOMAIN_JOB_UNBOUNDED) { + while (1) { /* Poll every 50ms for progress & to allow cancellation */ struct timespec ts = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000ull }; @@ -2391,6 +2391,9 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, break; } + if (jobInfo->type != VIR_DOMAIN_JOB_UNBOUNDED) + break; + virObjectUnlock(vm); nanosleep(&ts, NULL); -- GitLab