Re: [PATCH v3 0/9] add virDomainGetGuestInfo()

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

 



Tested the patch series with a ppc64 guest, using upstream QEMU
in a Power8 host:

$ sudo ./run tools/virsh guestinfo qga-test
user.count          : 1
user.0.name         : danielhb
user.0.login-time   : 1566588366375
os.id               : ubuntu
os.name             : Ubuntu
os.pretty-name      : Ubuntu 18.04.1 LTS
os.version          : 18.04.1 LTS (Bionic Beaver)
os.version-id       : 18.04
os.machine          : ppc64le
os.kernel-release   : 4.15.0-29-generic
os.kernel-version   : #31-Ubuntu SMP Tue Jul 17 15:37:15 UTC 2018
timezone.name       : CDT
timezone.offset     : -18000
hostname            : ubuntu1804
fs.count            : 1
fs.0.name           : vda2
fs.0.mountpoint     : /
fs.0.fstype         : ext4
fs.0.disk.count     : 1
fs.0.disk.0.alias   : vda


Looks good to me.



Thanks,


DHB


On 8/23/19 1:31 PM, Jonathon Jongsma wrote:
changes in v3:
- fixed test failure
- fixed syntax issues that I had missed since I forgot to install cppi on my
   new laptop

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, timezone, hostname, and filesystem info.

Filesystem information is already accessible via the public API
virDomainGetFSInfo(), but recent versions of the qemu guest agent added
additional information, and the existing public API is not able to be extended
without breaking API since it returns a C struct. This new API uses typed
parameters so that it can be extended as necessary when new fields are added.

The overall API follows the bulk 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).

It should be noted that like version 1 of this patch series, the API still only
operates on a single domain, not a list of domains. I'm willing to consider
changing the API to operate on a list of domains if that is the concensus, but
I lean toward keeping it simpler.

Here's an example of the output of the virsh command added in this patch
operating on a fedora 30 guest:
virsh # guestinfo fedora30
user.count          : 1
user.0.name         : test
user.0.login-time   : 1566422940895
os.id               : fedora
os.name             : Fedora
os.pretty-name      : Fedora 30 (Workstation Edition)
os.version          : 30 (Workstation Edition)
os.version-id       : 30
os.machine          : x86_64
os.variant          : Workstation Edition
os.variant-id       : workstation
os.kernel-release   : 5.2.7-200.fc30.x86_64
os.kernel-version   : #1 SMP Thu Aug 8 05:35:29 UTC 2019
timezone.name       : CDT
timezone.offset     : -18000
hostname            : myhostname
fs.count            : 3
fs.0.name           : dm-0
fs.0.mountpoint     : /
fs.0.fstype         : ext4
fs.0.total-bytes    : 25928306688
fs.0.used-bytes     : 10762133504
fs.0.disk.count     : 1
fs.0.disk.0.alias   : vda
fs.0.disk.0.serial  : 947684ABZ8639Q
fs.0.disk.0.device  : /dev/vda2
fs.1.name           : vda1
fs.1.mountpoint     : /boot
fs.1.fstype         : ext4
fs.1.total-bytes    : 952840192
fs.1.used-bytes     : 229019648
fs.1.disk.count     : 1
fs.1.disk.0.alias   : vda
fs.1.disk.0.serial  : 947684ABZ8639Q
fs.1.disk.0.device  : /dev/vda1
fs.2.name           : md127
fs.2.mountpoint     : /run/media/test/971b1edc-da61-4015-b465-560a9b1b6e9b
fs.2.fstype         : ext4
fs.2.total-bytes    : 1950134272
fs.2.used-bytes     : 6291456
fs.2.disk.count     : 2
fs.2.disk.0.alias   : vdb
fs.2.disk.0.device  : /dev/vdb1
fs.2.disk.1.alias   : vdc
fs.2.disk.1.device  : /dev/vdc1

In contrast, here is the output of the virsh command operating on a fedora24
guest:
virsh # guestinfo  fedora24
error: Reconnected to the hypervisor
fs.count            : 2
fs.0.name           : dm-0
fs.0.mountpoint     : /
fs.0.fstype         : ext4
fs.0.disk.count     : 1
fs.0.disk.0.alias   : vda
fs.1.name           : vda1
fs.1.mountpoint     : /boot
fs.1.fstype         : ext4
fs.1.disk.count     : 1
fs.1.disk.0.alias   : vda

However, if you specifically request an info category that is not supported by
the guest agent:
virsh # guestinfo --user fedora24
error: internal error: unable to execute QEMU agent command 'guest-get-users': The command guest-get-users has not been found



Jonathon Jongsma (9):
   lib: add virDomainGetGuestInfo()
   remote: implement virDomainGetGuestInfo
   qemu: add helper for getting guest users
   qemu: add helper function for querying OS info
   qemu: add helper for querying timezone info
   qemu: add support for new fields in FSInfo
   qemu: add helper for getting full FSInfo
   qemu: Implement virDomainGetGuestInfo()
   virsh: add 'guestinfo' command

  include/libvirt/libvirt-domain.h    |  14 +
  src/driver-hypervisor.h             |   8 +
  src/libvirt-domain.c                | 117 ++++++
  src/libvirt_public.syms             |   1 +
  src/qemu/qemu_agent.c               | 483 ++++++++++++++++++++++-
  src/qemu/qemu_agent.h               |   9 +
  src/qemu/qemu_driver.c              | 110 ++++++
  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               | 576 +++++++++++++++++++++++++++-
  tools/virsh-domain.c                |  85 ++++
  13 files changed, 1495 insertions(+), 35 deletions(-)


--
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