[libvirt] [PATCH v3 4/6] qemuDomainObjPrivate: Introduce blockJob condition
Jiri Denemark
jdenemar at redhat.com
Mon Feb 16 17:32:08 UTC 2015
On Fri, Feb 13, 2015 at 16:24:31 +0100, Michal Privoznik wrote:
> 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 at redhat.com>
> ---
> 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 */
Wouldn't "signals whenever a block job changes its state" or something
similar be more readable?
> +
> bool hookRun; /* true if there was a hook run over this domain */
> virBitmapPtr autoNodeset;
> };
Jirka
More information about the libvir-list
mailing list