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