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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux