[libvirt] [PATCH 1/4] Implement public API for virDomainGetIOThreadsInfo

Daniel P. Berrange berrange at redhat.com
Thu Feb 12 13:12:13 UTC 2015


On Thu, Feb 12, 2015 at 08:03:44AM -0500, John Ferlan wrote:
> Add virDomainGetIOThreadsInfo in order to returned a list of
> virDomainIOThreadsInfoPtr structures which list the IOThread ID,
> the thread_id, and the CPU Affinity map for each IOThread for
> the active domain.
> 
> Also added virDomainIOThreadsInfoFree in order to free the cpumap
> and the array entry structure.
> 
> For inactive domains or where IOThreads is not supported return
> an error and an empty structure
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  include/libvirt/libvirt-domain.h | 22 +++++++++++++-
>  src/driver-hypervisor.h          |  8 ++++-
>  src/libvirt-domain.c             | 63 +++++++++++++++++++++++++++++++++++++++-
>  src/libvirt_public.syms          |  6 ++++
>  4 files changed, 96 insertions(+), 3 deletions(-)
> 
> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
> index 4dbd7f5..54f8de4 100644
> --- a/include/libvirt/libvirt-domain.h
> +++ b/include/libvirt/libvirt-domain.h
> @@ -4,7 +4,7 @@
>   * Description: Provides APIs for the management of domains
>   * Author: Daniel Veillard <veillard at redhat.com>
>   *
> - * Copyright (C) 2006-2014 Red Hat, Inc.
> + * Copyright (C) 2006-2015 Red Hat, Inc.
>   *
>   * This library is free software; you can redistribute it and/or
>   * modify it under the terms of the GNU Lesser General Public
> @@ -1568,6 +1568,26 @@ int                     virDomainGetEmulatorPinInfo (virDomainPtr domain,
>                                                       unsigned int flags);
>  
>  /**
> + * virIOThreadsInfo:
> + *
> + * The data structure for information about IOThreads in a domain
> + */
> +typedef struct _virDomainIOThreadsInfo virDomainIOThreadsInfo;
> +typedef virDomainIOThreadsInfo *virDomainIOThreadsInfoPtr;
> +struct _virDomainIOThreadsInfo {
> +    unsigned int iothread_id;         /* IOThread ID */
> +    unsigned int thread_id;            /* Thread ID associated with IOThread */

Hmm, one thing we've avoided doing in the past is to expose the idea of PIDs
in any of the libvirt APIs - we  never expose the QEMU PID anywhere. So I
think I'd leave this thread_id field out of the info here, the iothread_id
should be sufficient for apps.  The actual thread_is should only be needed
internally by libvirt itself, in order to do pinning & so forth - we don't
want to have apps using it todo pinning themslves.

> +    unsigned char *cpumap;             /* CPU map for thread */
> +    int cpumaplen;                     /* cpumap size */
> +};
> +
> +void                 virDomainIOThreadsInfoFree(virDomainIOThreadsInfoPtr info);
> +
> +int                  virDomainGetIOThreadsInfo(virDomainPtr domain,
> +                                               virDomainIOThreadsInfoPtr **info,
> +                                               unsigned int flags);

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list