On 03/16/2017 10:29 AM, Peter Krempa wrote: > Management tools may want to check whether the threshold is still set if > they missed an event. Add the data to the bulk stats API where they can > also query the current backing size at the same time. Another way of reading it: the presence of the threshold in the bulk stats means the event has NOT fired yet. If the threshold is absent, either it was never registered, or an event was missed and a (new) threshold needs to be registered. > --- > src/libvirt-domain.c | 4 ++++ > src/qemu/qemu_driver.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++--- > tools/virsh.pod | 3 +++ > 3 files changed, 55 insertions(+), 3 deletions(-) > > diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c > index fd367bcb0..815cbb1e1 100644 > --- a/src/libvirt-domain.c > +++ b/src/libvirt-domain.c > @@ -11206,6 +11206,10 @@ virConnectGetDomainCapabilities(virConnectPtr conn, > * backing image as unsigned long long. > * "block.<num>.physical" - physical size in bytes of the container of the > * backing image as unsigned long long. > + * "block.<num>.threshold.storage - current threshold for delivering the Rather long name; would block.<num>.threshold be sufficient? > + * VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD > + * event in bytes. > + * See virDomainSetBlockThreshold. > * > * VIR_DOMAIN_STATS_PERF: > * Return perf event statistics. > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index 22cf866cd..a541b671d 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -19186,6 +19186,32 @@ qemuDomainGetStatsOneBlockFallback(virQEMUDriverPtr driver, > > > static int > +qemuDomainGetStatsOneBlockNode(virDomainStatsRecordPtr record, > + int *maxparams, > + virStorageSourcePtr src, > + size_t block_idx, > + virHashTablePtr nodedata) > +{ > + virJSONValuePtr data; > + unsigned long long tmp; > + int ret = -1; > + > + if (src->nodebacking && > + (data = virHashLookup(nodedata, src->nodebacking))) { > + if (virJSONValueObjectGetNumberUlong(data, "write_threshold", &tmp) == 0 && > + tmp > 0) > + QEMU_ADD_BLOCK_PARAM_ULL(record, maxparams, block_idx, > + "threshold.storage", tmp); Again, the name feels long, but I'm bikeshedding. The statistic itself is useful. ACK, whether or not you rename it -- 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