[libvirt] [PATCH 3/5] qemu: blockjob: Mark job as started only when it's new

Peter Krempa posted 5 patches 5 years, 10 months ago
[libvirt] [PATCH 3/5] qemu: blockjob: Mark job as started only when it's new
Posted by Peter Krempa 5 years, 10 months ago
Switching a block job to some states (e.g. QEMU_BLOCKJOB_STATE_READY)
might not require a job, thus if it will become ready asynchronously we
should not overwrite the state any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_blockjob.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index ba98ef2259..1b7a372434 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -149,7 +149,8 @@ qemuBlockJobDiskGetJob(virDomainDiskDefPtr disk)
 void
 qemuBlockJobStarted(qemuBlockJobDataPtr job)
 {
-    job->state = QEMU_BLOCKJOB_STATE_RUNNING;
+    if (job->state == QEMU_BLOCKJOB_STATE_NEW)
+        job->state = QEMU_BLOCKJOB_STATE_RUNNING;
 }


-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list