[libvirt] [PATCH 1/5] lib: add API to query info about logged-in users

Daniel P. Berrangé berrange at redhat.com
Thu Jul 11 11:09:23 UTC 2019


On Wed, Jul 10, 2019 at 03:07:43PM -0500, Jonathon Jongsma wrote:
> Add API for querying logged-in users from a domain implemented via
> guest agent.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---
>  include/libvirt/libvirt-domain.h | 18 ++++++++++
>  src/driver-hypervisor.h          |  6 ++++
>  src/libvirt-domain.c             | 62 ++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms          |  5 +++
>  4 files changed, 91 insertions(+)
> 
> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
> index 2dbd74d4f3..82dbbd3fc5 100644
> --- a/include/libvirt/libvirt-domain.h
> +++ b/include/libvirt/libvirt-domain.h
> @@ -4896,4 +4896,22 @@ int virDomainGetLaunchSecurityInfo(virDomainPtr domain,
>                                     int *nparams,
>                                     unsigned int flags);
>  
> +/**
> + * virDomainUserInfo:
> + *
> + * The data structure containing informationa bout logged-in users within a
> + * guest
> + */
> +typedef struct _virDomainUserInfo virDomainUserInfo;
> +typedef virDomainUserInfo *virDomainUserInfoPtr;
> +struct _virDomainUserInfo {
> +    char *user; /* username */
> +    char *domain; /* login domain (windows only) */
> +    unsigned long long loginTime; /* timestamp of login for this user in ms since epoch */
> +};
> +int virDomainGetGuestUsers(virDomainPtr domain,
> +                           virDomainUserInfoPtr **info,
> +                           unsigned int flags);

I can easily imagine QEMU returning more info per user in future, so
using a struct is not futureproof design.

We should use the virTypedParameter approach instead here.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list