[PATCH 2/3] qemu: update legacy block job sync after offloading changes

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

 



Now block job can be created by qemuProcessHandleBlockJob during reconnect
before we start to synchronize block jobs. Also pending event can hold state
change we see during sync and in this case we don't need to process the pending
event.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
 src/qemu/qemu_process.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 4d63e7d..ff79832 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8022,7 +8022,9 @@ qemuProcessRefreshLegacyBlockjob(void *payload,
         disk->mirrorJob == VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT)
         jobtype = disk->mirrorJob;
 
-    if (!(job = qemuBlockJobDiskNew(vm, disk, jobtype, jobname)))
+    /* Job can be created by block job event handler */
+    if (!(job = qemuBlockJobDiskGetJob(disk)) &&
+        !(job = qemuBlockJobDiskNew(vm, disk, jobtype, jobname)))
         return -1;
 
     if (disk->mirror) {
@@ -8030,6 +8032,10 @@ qemuProcessRefreshLegacyBlockjob(void *payload,
             (info->ready == -1 && info->end == info->cur)) {
             disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_READY;
             job->state = VIR_DOMAIN_BLOCK_JOB_READY;
+
+            /* Reset pending event if we already in the state of event */
+            if (job->newstate == VIR_DOMAIN_BLOCK_JOB_READY)
+                job->newstate = -1;
         }
 
         /* Pre-blockdev block copy labelled the chain of the mirrored device
-- 
1.8.3.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