[libvirt] [PATCH 09/23] qemu: process: Wire up firing of the VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD event

Eric Blake eblake at redhat.com
Thu Mar 23 01:17:12 UTC 2017


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170322/4cfc0bfb/attachment-0001.sig>


More information about the libvir-list mailing list