Bug 1705517

Summary: Provide info from guest-get-osinfo QEMU-GA command
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Tomáš Golembiovský <tgolembi>
Component: libvirtAssignee: Jonathon Jongsma <jjongsma>
Status: CLOSED ERRATA QA Contact: Lili Zhu <lizhu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: chhu, jdenemar, knoel, lcheng, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-5.9.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-05 09:45:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomáš Golembiovský 2019-05-02 12:45:32 UTC
Please include output of guest-get-osinfo QEMU-GA command into bulk stats
reported for domains. This feature is required for efficient consumption of
qemu-ga info in oVirt.

Comment 1 Jonathon Jongsma 2019-08-02 17:54:06 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 2 Jonathon Jongsma 2019-08-30 19:43:15 UTC
virDomainGetGuestInfo() patches were merged upstream.

Comment 5 Jonathon Jongsma 2019-12-03 18:11:04 UTC
In virsh, this information is returned in the new 'guestinfo' command.

Comment 7 Jonathon Jongsma 2020-01-21 18:11:22 UTC
*** Bug 1704763 has been marked as a duplicate of this bug. ***

Comment 8 Lili Zhu 2020-02-05 07:25:58 UTC
Verify this bug with:
libvirt-6.0.0-2.module+el8.2.0+5513+34927b6c.x86_64
qemu-guest-agent-4.2.0-8.module+el8.2.0+5607+dc756904.x86_64

A) positive scenarios:
1) prepare one rhel and one linux guest
# virsh list --all
 Id   Name                       State
-------------------------------------------
 2    rhel8.1                    running
 3    win10                      running

2)check the os info
[root@localhost ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.1 (Ootpa)
[root@localhost ~]# uname -a
Linux localhost.localdomain 4.18.0-147.el8.x86_64 #1 SMP Thu Sep 26 15:52:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

3)check the os info via guest agent
# virsh guestinfo rhel8.1 --os
os.id               : rhel
os.name             : Red Hat Enterprise Linux
os.pretty-name      : Red Hat Enterprise Linux 8.1 (Ootpa)
os.version          : 8.1 (Ootpa)
os.version-id       : 8.1
os.machine          : x86_64
os.kernel-release   : 4.18.0-147.el8.x86_64
os.kernel-version   : #1 SMP Thu Sep 26 15:52:44 UTC 2019

4)update the guest os and reboot, check the os info
# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.2 Beta (Ootpa)
[root@localhost ~]# uname -a
Linux localhost.localdomain 4.18.0-167.el8.x86_64 #1 SMP Sun Dec 15 01:24:23 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

5)check the os info via guest agent again
# virsh guestinfo rhel8.1 --os
os.id               : rhel
os.name             : Red Hat Enterprise Linux
os.pretty-name      : Red Hat Enterprise Linux 8.2 Beta (Ootpa)
os.version          : 8.2 (Ootpa)
os.version-id       : 8.2
os.machine          : x86_64
os.kernel-release   : 4.18.0-167.el8.x86_64
os.kernel-version   : #1 SMP Sun Dec 15 01:24:23 UTC 2019

6)check the os info of windows guest
# virsh guestinfo win10 --os
os.id               : mswindows
os.name             : Microsoft Windows
os.pretty-name      : Windows 10 Enterprise
os.version          : Microsoft Windows 10
os.version-id       : 10
os.machine          : x86_64
os.variant          : client
os.variant-id       : client
os.kernel-release   : 18363
os.kernel-version   : 10.0

Negative Scenarios:
1) check the os info under read-only mode
# virsh -r guestinfo win10 --os
error: operation forbidden: read only access prevents virDomainGetGuestInfo

2) check the os info when guest agent is not connected
[root@localhost ~]# systemctl stop qemu-guest-agent
[root@localhost ~]# 
[root@localhost ~]# 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-02-05 15:20:59 CST; 11s ago
  Process: 826 ExecStart=/usr/bin/qemu-ga --method=virtio-serial --path=/dev/vi>
 Main PID: 826 (code=exited, status=0/SUCCESS)

Feb 05 14:43:27 localhost.localdomain systemd[1]: Started QEMU Guest Agent.
Feb 05 15:20:59 localhost.localdomain systemd[1]: Stopping QEMU Guest Agent...
Feb 05 15:20:59 localhost.localdomain systemd[1]: Stopped QEMU Guest Agent.

# virsh guestinfo rhel8.1 --os
error: Guest agent is not responding: QEMU guest agent is not connected

3)check guest os info when guest agent is not configured
# virsh dumpxml rhel8.1 |grep agent
(no output)
# virsh guestinfo rhel8.1 --os
error: argument unsupported: QEMU guest agent is not configured

Comment 9 Lili Zhu 2020-02-21 03:01:30 UTC
As the testing match with expected results, mark the bug as verified

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