From 1c71a7ae3740784e8db70124370ea64522b888ac 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 --- src/qemu/qemu_migration.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 29f5173..af44b69 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2389,6 +2389,12 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, /* Poll every 50ms for progress & to allow cancellation */ struct timespec ts = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000ull }; + virObjectUnlock(vm); + + nanosleep(&ts, NULL); + + virObjectLock(vm); + if (qemuMigrationUpdateJobStatus(driver, vm, job, asyncJob) == -1) break; @@ -2407,11 +2413,6 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, break; } - virObjectUnlock(vm); - - nanosleep(&ts, NULL); - - virObjectLock(vm); } if (jobInfo->type == VIR_DOMAIN_JOB_COMPLETED) { -- 1.9.5 (Apple Git-50.3)