Please include output of guest-get-host-name QEMU-GA command into bulk stats reported for domains. This feature is required for efficient consumption of qemu-ga info in oVirt.
I don't think we should put this into the statistics API. This is something that does not change much and thus querying it with all the other stats is counter-productive.
Looking at the other BZs regarding guest agent, I think we need a new API which will return all the guest agent stuff for a VM in a format similar to the stats.
I have posted a proposed patch series to the mailing list here: https://www.redhat.com/archives/libvir-list/2019-August/msg00016.html. It adds a new virDomainGetGuestInfo() API which returns various guest parameters in a typed parameter array. This should make it possible to extend in the future without breaking API.
virDomainGetGuestInfo() patches were merged upstream.
Tested with: libvirt-daemon-5.9.0-4.module+el8.2.0+4836+a8e32ad7.x86_64 qemu-kvm-4.2.0-1.module+el8.2.0+4793+b09dd2fb.x86_64 1. get hostname from QEMU-GA command # virsh guestinfo --hostname avocado-vt-vm1 hostname : localhost.localdomain 2. check the statistics about hostname # virsh domstats avocado-vt-vm1 |grep hostname (no output)
Hi, Jonathon From the discussions above and the testing results, it seems that the guest info returned by QEMU-GA command will not be shown in statistics. I think we may need to close the bug as the bug title would make others confused, since we are not going to provide info from guest-get-host-name QEMU-GA command in bulk stats. And the same with other similar bugs.
When the bug was initially filed, the reporter suggested to add the information to bulk stats, but we since decided to return the information in a different command. I've changed the bug title to omit the reference to bulk stats.
Verify this bug with: qemu-guest-agent-4.2.0-6.module+el8.2.0+5453+31b2b136.x86_64 libvirt-6.0.0-2.module+el8.2.0+5513+34927b6c.x86_64 Positive Scenario, 1. prepare windows and rhel guests # virsh list --all Id Name State ------------------------------------------- 2 win10 running 3 rhel8.2 running 2. get the hostname of the guest # virsh guestinfo rhel8.2 --hostname hostname : myhost 3. change the hostname in guest # virsh console rhel8.2 Connected to domain rhel8.2 Escape character is ^] [root@myhost ~]# hostnamectl set-hostname newhost [root@8-1-virt ~]# virsh reboot rhel8.2 Domain rhel8.2 is being rebooted 4. get the rhel guest hostname again [root@8-1-virt ~]# virsh guestinfo rhel8.2 --hostname hostname : newhost 5. check the windows guest hostname # virsh guestinfo win10 --hostname hostname : DESKTOP-99HM3SU 6. change the windows guest hostname and restart 7. check the hostname again # virsh guestinfo win10 --hostname hostname : WIN10-GUEST Can query the guest hostname correctly Negative Scenarios: 1. try to get hostname under readonly mode # virsh -r guestinfo rhel8.2 --hostname error: operation forbidden: read only access prevents virDomainGetGuestInfo 2. try to get hostname when guest agent is not configured # virsh dumpxml rhel8.2 |grep agent (no output) # virsh guestinfo rhel8.2 --hostname error: argument unsupported: QEMU guest agent is not configured 3. try to get hostname when guest agent is not connected # virsh console rhel8.2 Connected to domain rhel8.2 Escape character is ^] Red Hat Enterprise Linux 8.2 Beta (Ootpa) Kernel 4.18.0-167.el8.x86_64 on an x86_64 newhost login: root Password: Last login: Wed Jan 22 01:55:39 on ttyS0 [root@newhost ~]# systemctl stop qemu-guest-agent [root@newhost ~]# systemctl status qemu-guest-agent ● qemu-guest-agent.service - QEMU Guest Agent Loaded: loaded (/usr/lib/systemd/system/qemu-guest-agent.service; disabled; > Active: inactive (dead) since Wed 2020-01-22 02:00:51 EST; 7s ago Process: 818 ExecStart=/usr/bin/qemu-ga --method=virtio-serial --path=/dev/vi> Main PID: 818 (code=exited, status=0/SUCCESS) Jan 22 01:56:34 newhost systemd[1]: Started QEMU Guest Agent. Jan 22 02:00:51 newhost systemd[1]: Stopping QEMU Guest Agent... Jan 22 02:00:51 newhost systemd[1]: Stopped QEMU Guest Agent. lines 1-9/9 (END) [root@8-1-virt ~]# virsh guestinfo rhel8.2 --hostname error: Guest agent is not responding: QEMU guest agent is not connected
Hi, Jonathon Please help to check whether the testing scope in Comment 11 is enough to verify this bug. Thanks
Yes, that looks sufficient.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:2017