[PATCH v3 4/6] qemuDomainObjPrivate: Introduce blockJob condition

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

 



So far the condition is not used, but will be. There are some
operations, where we actively wait for a block job to complete.
Instead of locking and unlocking the domain object, entering and
leaving monitor, lets just use a condition and let our monitor
event handling code wake up when needed.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 4 +++-
 src/qemu/qemu_domain.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 99c46d4..28961d2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -406,7 +406,8 @@ qemuDomainObjPrivateAlloc(void)
         goto error;
     }
 
-    if (virCondInit(&priv->unplugFinished) < 0)
+    if (virCondInit(&priv->unplugFinished) < 0 ||
+        virCondInit(&priv->blockJob) < 0)
         goto error;
 
     if (!(priv->devs = virChrdevAlloc()))
@@ -439,6 +440,7 @@ qemuDomainObjPrivateFree(void *data)
     VIR_FREE(priv->origname);
 
     virCondDestroy(&priv->unplugFinished);
+    virCondDestroy(&priv->blockJob);
     virChrdevFree(priv->devs);
 
     /* This should never be non-NULL if we get here, but just in case... */
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index b2c3881..db9ffac 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -186,6 +186,8 @@ struct _qemuDomainObjPrivate {
     const char *unpluggingDevice; /* alias of the device that is being unplugged */
     char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
 
+    virCond blockJob; /* signals that one of disks translated state of a block job */
+
     bool hookRun;  /* true if there was a hook run over this domain */
     virBitmapPtr autoNodeset;
 };
-- 
2.0.5

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




[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]