[libvirt] [PATCH 0/7] add virDomainGetGuestInfo()

Jonathon Jongsma jjongsma at redhat.com
Thu Aug 1 13:37:03 UTC 2019


This series adds several bits of guest information provided by a new API
function virDomainGetGuestInfo(). There is an implementation for qemu using the
guest agent. In particular, it adds information about logged-in users, guest
OS, and timezone.

I had previously submitted a patch series with a dedicated API function for
querying guest users that returned an array of structures describing the users.
It was suggested that I convert his to a more futureproof design using typed
parameters and also combine it with other bits of guest information similar to
virDomainListGetStats(). In fact, there were several bugs that requested this
information be added to the 'bulk stats' API, but Peter Krempa suggested adding
a new API for all data queried from the guest agent (see
https://bugzilla.redhat.com/show_bug.cgi?id=1705514). This is that API
proposal. It follows the stats API quite closely, and tries to return data in
similar ways (for example, the "users.N.*" field name scheme was inspired by
various stats fields).

I plan to follow this series up with a patch that adds fsinfo to the returned
information, but wanted to get comments on this approach now.

Here's an example of the output of the virsh command added in this patch:

virsh # guestinfo win7
users.count         : 1
users.0.name        : test
users.0.domain      : test-PC
users.0.login_time  : 1564664122706
os.id               : mswindows
os.name             : Microsoft Windows
os.pretty-name      : Windows 7 Professional
os.version          : Microsoft Windows 77
os.version-id       :
os.machine          : x86_64
os.variant          : client
os.variant-id       : client
os.kernel-release   : 7601
os.kernel-version   : 6.1
timezone.name       : Central Daylight Time
timezone.offset     : -18000
hostname            : TEST-PC

Jonathon Jongsma (7):
  lib: add virDomainGetGuestInfo()
  remote: implement virDomainGetGuestInfo
  qemu_agent: add helper for getting guest users
  qemu_agent: add helper function for querying OS info
  qemu_agent: add helper for querying timezone info
  qemu: Implement virDomainGetGuestInfo()
  virsh: add 'guestinfo' command

 include/libvirt/libvirt-domain.h    |  13 +
 src/driver-hypervisor.h             |   8 +
 src/libvirt-domain.c                | 105 ++++++++
 src/libvirt_public.syms             |   1 +
 src/qemu/qemu_agent.c               | 190 +++++++++++++++
 src/qemu/qemu_agent.h               |   4 +
 src/qemu/qemu_driver.c              |  77 ++++++
 src/remote/remote_daemon_dispatch.c |  41 ++++
 src/remote/remote_driver.c          |  53 ++++
 src/remote/remote_protocol.x        |  21 +-
 src/remote_protocol-structs         |  12 +
 tests/qemuagenttest.c               | 366 ++++++++++++++++++++++++++++
 tools/virsh-domain.c                |  53 ++++
 13 files changed, 943 insertions(+), 1 deletion(-)

-- 
2.21.0




More information about the libvir-list mailing list