
On 03/15/2017 11:37 AM, Peter Krempa wrote:
Bind it to qemus BLOCK_WRITE_THRESHOLD event. Look up the disk by
s/qemus/qemu's/
nodename and construct the string to return. --- src/qemu/qemu_process.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
static int +qemuProcessHandleBlockThreshold(qemuMonitorPtr mon ATTRIBUTE_UNUSED, + virDomainObjPtr vm, + const char *nodename, + unsigned long long threshold, + unsigned long long excess, + void *opaque) +{ + virQEMUDriverPtr driver = opaque; + virObjectEventPtr event = NULL; + virDomainDiskDefPtr disk; + virStorageSourcePtr src; + unsigned int idx; + char *dev = NULL; + const char *path = NULL; + + virObjectLock(vm); + + VIR_DEBUG("BLOCK_WRITE_THRESHOLD event for block node '%s' in domain %p %s:" + "threshold '%llu' exceeded by '%llu'", + nodename, vm, vm->def->name, threshold, excess); + + if ((disk = qemuDomainDiskLookupByNodename(vm->def, nodename, &src, &idx))) { + if (virStorageSourceIsLocalStorage(src)) + path = src->path; + + if ((dev = qemuDomainDiskBackingStoreGetName(disk, src, idx))) { + event = virDomainEventBlockThresholdNewFromObj(vm, dev, path, + threshold, excess); + } + } + + virObjectUnlock(vm); + qemuDomainEventQueue(driver, event); + + return 0;
Does this leak dev? Okay, this looks like it fixes my concern on the earlier patch - you are indeed mapping qemu's node name into a proper XML-related name for the consumer of the event. ACK once you fix any leaks. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org