[libvirt] [PATCH v3 1/9] lib: add virDomainGetGuestInfo()

Michal Privoznik mprivozn at redhat.com
Mon Aug 26 15:29:42 UTC 2019


On 8/23/19 6:31 PM, Jonathon Jongsma wrote:
> This API is intended to aggregate several guest agent information
> queries and is ispired by stats API virDomainListGetStats(). It is
> anticipated that this information will be provided by a guest agent
> running within the domain.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---
>   include/libvirt/libvirt-domain.h |  14 ++++
>   src/driver-hypervisor.h          |   8 +++
>   src/libvirt-domain.c             | 117 +++++++++++++++++++++++++++++++
>   src/libvirt_public.syms          |   1 +
>   4 files changed, 140 insertions(+)

> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index 2fe9bb8e91..ad68db7549 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c


> +int virDomainGetGuestInfo(virDomainPtr domain,
> +                          unsigned int types,
> +                          virTypedParameterPtr *params,
> +                          int *nparams,
> +                          unsigned int flags)
> +{
> +    VIR_DOMAIN_DEBUG(domain, "types=%u, params=%p, nparams=%p, flags=0x%x",
> +                     types, params, nparams, flags);

I think that @types should also be written in hex format since it's a 
bitwise-OR of integer values.

> +
> +    virResetLastError();
> +
> +    virCheckDomainReturn(domain, -1);
> +    virCheckReadOnlyGoto(domain->conn->flags, error);
> +
> +    virCheckNonNullArgGoto(params, error);
> +    virCheckNonNullArgGoto(nparams, error);
> +
> +    if (domain->conn->driver->domainGetGuestInfo) {
> +        int ret;
> +        ret = domain->conn->driver->domainGetGuestInfo(domain, types,
> +                                                       params, nparams, flags);
> +
> +        if (ret < 0)
> +            goto error;
> +        return ret;
> +    }
> +
> +    virReportUnsupportedError();
> +
> + error:
> +    virDispatchError(domain->conn);
> +    return -1;
> +}
>   
>   /**
>    * virDomainSetBlockThreshold:
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index 54256b6317..e196fd11d9 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -850,6 +850,7 @@ LIBVIRT_5.6.0 {
>           virDomainCheckpointLookupByName;
>           virDomainCheckpointRef;
>           virDomainListAllCheckpoints;
> +        virDomainGetGuestInfo;
>   } LIBVIRT_5.5.0;

Unfortunatelly, 5.6.0 is gone. This needs to be a new section of name 
LIBVIRT_5.7.0.

Michal




More information about the libvir-list mailing list