]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_migration.c: sleep first before checking for migration status.
authorXing Lin <xinglin@cs.utah.edu>
Thu, 9 Apr 2015 22:02:02 +0000 (16:02 -0600)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 13 Apr 2015 07:52:28 +0000 (09:52 +0200)
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 <xinglin@cs.utah.edu>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_migration.c

index 29f5173b1f8ee0cefe9d3a91d3f5b6542ab0175d..b597c80ee252aa51aab3c388190aa8c4ed5d4217 100644 (file)
@@ -2385,7 +2385,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 };
 
@@ -2407,6 +2407,9 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
             break;
         }
 
+        if (jobInfo->type != VIR_DOMAIN_JOB_UNBOUNDED)
+            break;
+
         virObjectUnlock(vm);
 
         nanosleep(&ts, NULL);