mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
lib: Introduce event for tracking disk backing file write threshold
When using thin provisioning, management tools need to resize the disk in certain cases. To avoid having them to poll disk usage introduce an event which will be fired when a given offset of the storage is written by the hypervisor. Together with the API which will be added later, it will allow registering thresholds for given storage backing volumes and this event will then notify management if the threshold is exceeded.
This commit is contained in:
@@ -12877,6 +12877,25 @@ virshEventMetadataChangePrint(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
virshEventBlockThresholdPrint(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainPtr dom,
|
||||
const char *dev,
|
||||
const char *path,
|
||||
unsigned long long threshold,
|
||||
unsigned long long excess,
|
||||
void *opaque)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
virBufferAsprintf(&buf, _("event 'block-threshold' for domain %s: "
|
||||
"dev: %s(%s) %llu %llu\n"),
|
||||
virDomainGetName(dom),
|
||||
dev, NULLSTR(path), threshold, excess);
|
||||
virshEventPrint(opaque, &buf);
|
||||
}
|
||||
|
||||
|
||||
static vshEventCallback vshEventCallbacks[] = {
|
||||
{ "lifecycle",
|
||||
VIR_DOMAIN_EVENT_CALLBACK(virshEventLifecyclePrint), },
|
||||
@@ -12924,6 +12943,8 @@ static vshEventCallback vshEventCallbacks[] = {
|
||||
VIR_DOMAIN_EVENT_CALLBACK(virshEventDeviceRemovalFailedPrint), },
|
||||
{ "metadata-change",
|
||||
VIR_DOMAIN_EVENT_CALLBACK(virshEventMetadataChangePrint), },
|
||||
{ "block-threshold",
|
||||
VIR_DOMAIN_EVENT_CALLBACK(virshEventBlockThresholdPrint), },
|
||||
};
|
||||
verify(VIR_DOMAIN_EVENT_ID_LAST == ARRAY_CARDINALITY(vshEventCallbacks));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user