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

Eric Blake eblake at redhat.com
Fri Mar 13 19:36:13 UTC 2015


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150313/b46a9417/attachment-0001.sig>


More information about the libvir-list mailing list