Re: [PATCH 3/3] qemu: Disallow concurrent block jobs on a single disk

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

 



On 03/13/2015 10:25 AM, Peter Krempa wrote:
> While qemu may be prepared to do this libvirt is not. Forbid the block
> ops until we fix our code.
> ---
>  src/conf/domain_conf.h |  1 +
>  src/qemu/qemu_domain.c | 23 +++++++++++++++++++++++
>  src/qemu/qemu_domain.h |  2 ++
>  src/qemu/qemu_driver.c | 28 +++++++++++++---------------
>  4 files changed, 39 insertions(+), 15 deletions(-)
> 
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index ea463cb..6f2df46 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -664,6 +664,7 @@ struct _virDomainDiskDef {
>      int tray_status; /* enum virDomainDiskTray */
>      int removable; /* enum virTristateSwitch */
> 
> +    bool blockjob;

Might be worth a FIXME comment acknowledging that a bool will be
insufficient when we update our code to support parallel jobs.

> +
> +bool
> +qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk)
> +{
> +    if (disk->mirror) {
> +        virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
> +                       _("disk '%s' already in active block job"),
> +                       disk->dst);
> +
> +        return true;
> +    }
> +
> +    if (disk->blockjob) {
> +        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> +                       _("disk '%s' already in active block job"),
> +                       disk->dst);
> +        return true;
> +    }

Shorter as 'if (disk->mirror || disk->blockjob)', up to you if you want
to compress the common code.

ACK.  Looks like you have correctly locked out blockpull, blockcopy, and
blockcommit as the three jobs that are all mutually exclusive according
to our current abilities.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP 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]