Bug 1705514 - Provide info from guest-get-host-name QEMU-GA command
Summary: Provide info from guest-get-host-name QEMU-GA command
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jonathon Jongsma
QA Contact: Lili Zhu
URL:
Whiteboard:
Depends On:
Blocks: 1755482
TreeView+ depends on / blocked
 
Reported: 2019-05-02 12:42 UTC by Tomáš Golembiovský
Modified: 2020-05-12 06:11 UTC (History)
7 users (show)

Fixed In Version: libvirt-5.9.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1755482 (view as bug list)
Environment:
Last Closed: 2020-05-05 09:45:18 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:2017 0 None None None 2020-05-05 09:46:07 UTC

Description Tomáš Golembiovský 2019-05-02 12:42:55 UTC
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.

Comment 1 Peter Krempa 2019-05-02 14:34:32 UTC
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.

Comment 2 Peter Krempa 2019-05-02 15:29:03 UTC
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.

Comment 3 Jonathon Jongsma 2019-08-02 17:53:51 UTC
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.

Comment 4 Jonathon Jongsma 2019-08-30 19:42:17 UTC
virDomainGetGuestInfo() patches were merged upstream.

Comment 7 Lili Zhu 2019-11-29 09:06:58 UTC
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)

Comment 8 Lili Zhu 2019-11-29 09:13:30 UTC
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.

Comment 9 Jonathon Jongsma 2019-12-02 21:11:21 UTC
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.

Comment 11 Lili Zhu 2020-01-22 08:24:39 UTC
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

Comment 12 Lili Zhu 2020-01-22 08:29:08 UTC
Hi, Jonathon

Please help to check whether the testing scope in Comment 11 
is enough to verify this bug. Thanks

Comment 13 Jonathon Jongsma 2020-02-18 16:52:38 UTC
Yes, that looks sufficient.

Comment 15 errata-xmlrpc 2020-05-05 09:45:18 UTC
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


Note You need to log in before you can comment on or make changes to this bug.