Re: [PATCH v3 02/24] qemu: Introduce qemuBlockJobUpdate

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

 



On Wed, Jun 10, 2015 at 15:42:36 +0200, Jiri Denemark wrote:
> The wrapper is useful for calling qemuBlockJobEventProcess with the
> event details stored in disk's privateData, which is the most likely
> usage of qemuBlockJobEventProcess.
> 
> Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
> ---
> 
> Notes:
>     ACKed in version 1 and 2
>     
>     Version 3:
>     - better flow in qemuBlockJobUpdate
>     - document qemuBlockJobUpdate
>     
>     Version 2:
>     - no changes
>     
>     ACKed in version 1 and 2
>     
>     Version 3:
>     - better flow in qemuBlockJobUpdate
>     
>     Version 2:
>     - no changes
> 
>  src/libvirt_private.syms |  2 ++
>  src/qemu/qemu_blockjob.c | 47 +++++++++++++++++++++++++++++++++++++++--------
>  src/qemu/qemu_blockjob.h |  3 +++
>  3 files changed, 44 insertions(+), 8 deletions(-)
> 

...

> diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
> index 098a43a..eb05cef 100644
> --- a/src/qemu/qemu_blockjob.c
> +++ b/src/qemu/qemu_blockjob.c
> @@ -38,6 +38,37 @@
>  
>  VIR_LOG_INIT("qemu.qemu_blockjob");
>  
> +
> +/**
> + * qemuBlockJobUpdate:
> + * @driver: qemu driver
> + * @vm: domain
> + * @disk: domain disk
> + *
> + * Update disk's mirror state in response to a block job event stored in
> + * blockJobStatus by qemuProcessHandleBlockJob event handler.
> + *
> + * Returns the block job event processed or -1 if there was no pending event.
> + */
> +int
> +qemuBlockJobUpdate(virQEMUDriverPtr driver,
> +                   virDomainObjPtr vm,
> +                   virDomainDiskDefPtr disk)
> +{
> +    qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
> +    int status = diskPriv->blockJobStatus;
> +
> +    if (status != -1) {
> +        qemuBlockJobEventProcess(driver, vm, disk,
> +                                 diskPriv->blockJobType,
> +                                 diskPriv->blockJobStatus);
> +        diskPriv->blockJobStatus = -1;
> +    }
> +
> +    return status;
> +}

Looks much better!

> +
> +
>  /**
>   * qemuBlockJobEventProcess:
>   * @driver: qemu driver

ACK,

Peter

Attachment: signature.asc
Description: Digital signature

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