Bug 1705519

Summary: Provide info from guest-get-timezone 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: 8.0   
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:47:16 UTC
Please include output of guest-get-timezone 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-30 19:43:39 UTC
timezone information was included in virDomainGetGuestInfo() patches which have been merged upstream.

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

Comment 6 Jonathon Jongsma 2020-01-21 17:47:42 UTC
*** Bug 1704764 has been marked as a duplicate of this bug. ***

Comment 7 Lili Zhu 2020-02-03 08:49:44 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.2                    running
 3    win10                      running

2) check timezone of rhel guest
[root@newhost ~]# timedatectl status
               Local time: Mon 2020-02-03 16:07:16 CST
           Universal time: Mon 2020-02-03 08:07:16 UTC
                 RTC time: Mon 2020-02-03 08:07:15
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

3) check timezone via guest agent
# virsh guestinfo rhel8.2 --timezone 
timezone.name       : CST
timezone.offset     : 28800

4) change timezone in guest
[root@newhost ~]# timedatectl set-timezone America/New_York
[root@newhost ~]# timedatectl status
               Local time: Mon 2020-02-03 03:09:55 EST
           Universal time: Mon 2020-02-03 08:09:55 UTC
                 RTC time: Mon 2020-02-03 08:09:54
                Time zone: America/New_York (EST, -0500)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

5)check timezone via guest agent
# virsh guestinfo rhel8.2 --timezone 
timezone.name       : EST
timezone.offset     : -18000

6) check timezone in windows guest 
PS C:\Users\test> Get-TimeZone


Id                         : China Standard Time
DisplayName                : (UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi
StandardName               : China Standard Time
DaylightName               : China Daylight Time
BaseUtcOffset              : 08:00:00
SupportsDaylightSavingTime : False

7)get guest timezone via guest agent
# virsh guestinfo win10 --timezone 
timezone.name       : China Standard Time
timezone.offset     : 28800

8) change windows guest timezone
PS C:\Users\test> Get-TimeZone


Id                         : E. Australia Standard Time
DisplayName                : (UTC+10:00) Brisbane
StandardName               : E. Australia Standard Time
DaylightName               : E. Australia Daylight Time
BaseUtcOffset              : 10:00:00
SupportsDaylightSavingTime : False

8) check guest timezone via guest agent
# virsh guestinfo win10 --timezone 
timezone.name       : E. Australia Standard Time
timezone.offset     : 36000

Negative scenarios:
1) get guest timezone info under read-only mode
# virsh -r guestinfo win10 --timezone 
error: operation forbidden: read only access prevents virDomainGetGuestInfo

2) stop guest agent service in guest, then get guest timezone
[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 Mon 2020-02-03 03:45:17 EST; 35s ago
  Process: 824 ExecStart=/usr/bin/qemu-ga --method=virtio-serial --path=/dev/vi>
 Main PID: 824 (code=exited, status=0/SUCCESS)

Feb 02 22:11:45 newhost systemd[1]: Started QEMU Guest Agent.
Feb 03 03:45:17 newhost systemd[1]: Stopping QEMU Guest Agent...
Feb 03 03:45:17 newhost systemd[1]: Stopped QEMU Guest Agent.

[root@8-1-virt ~]# virsh guestinfo rhel8.2 --timezone
error: Guest agent is not responding: QEMU guest agent is not connected

3) get guest timezone when guest agent is not configured
# virsh guestinfo rhel8.2 --timezone
error: argument unsupported: QEMU guest agent is not configured

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

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