Re: [PATCH 10/23] lib: Add API for setting the threshold size for VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD

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

 



On 03/15/2017 11:37 AM, Peter Krempa wrote:
> The new API can be used to configure the threshold when
> VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD should be fired.
> ---

> +++ b/src/libvirt-domain.c
> @@ -11822,3 +11822,54 @@ virDomainSetVcpu(virDomainPtr domain,
>      virDispatchError(domain->conn);
>      return -1;
>  }
> +
> +
> +/**
> + * virDomainSetBlockThreshold:
> + * @domain: pointer to domain object
> + * @dev: string specifying the block device or backing chain element
> + * @threshold: threshold in bytes when to fire the event
> + * @flags: currently unused, callers should pass 0
> + *
> + * Set the threshold level for delivering the
> + * VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD if the device or backing chain element
> + * described by @dev is written beyond the set threshold level. The threshold
> + * level is unset once the event fired. The event may not be delivered at all if

maybe s/may/might/

> + * libvirtd was not running at the moment when the threshold was reached.

We should document that the user can already poll the current write
levels via querying block status information, to make it obvious that
missing the event isn't necessarily fatal (when first [re-]connecting to
libvirt, use the poll operation; from there, you can rely on the event
to avoid further polling)

> + *
> + * This event allows to use thin-provisioned storage which needs management
> + * tools to grow it without the need for polling of the data.
> + *
> + * Returns 0 if the operation has started, -1 on failure.
> + */
> +int
> +virDomainSetBlockThreshold(virDomainPtr domain,
> +                           const char *dev,
> +                           unsigned long long threshold,
> +                           unsigned int flags)

Hmm. Because the threshold resets once the event fires, we don't have a
handy way to say 'set a threshold 100M or 10% further out than the last
limit).  That would be a reason for using flags, although I don't think
we need to worry about it for now.

Does setting the threshold lower than the current high-water mark (as
reported by polling block status information) immediately fire an event,
or will an event never fire in that situation?

> @@ -6048,6 +6056,13 @@ enum remote_procedure {
>       * @generate: both
>       * @acl: none
>       */
> -    REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD = 385
> +    REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD = 385,
> +
> +    /**
> +     * @generate: both
> +     * @acl: domain:write

This doesn't modify the domain.  Why does it need domain:write; wouldn't
domain:read be sufficient (namely, the same privileges you already
require for polling block status information to learn the current high
water mark)?

-- 
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]
  Powered by Linux