RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1224023 - The hwclock and systemclock of guest should be ccoincident while set a invalid domtime with guest agent
Summary: The hwclock and systemclock of guest should be ccoincident while set a invali...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-guest-agent
Version: 7.2
Hardware: x86_64
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Marc-Andre Lureau
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-22 02:45 UTC by zhenfeng wang
Modified: 2015-11-19 07:11 UTC (History)
9 users (show)

Fixed In Version: qemu-guest-agent-2.3.0-4.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 07:11:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2217 0 normal SHIPPED_LIVE qemu-guest-agent bug fix and enhancement update 2015-11-19 08:26:27 UTC

Description zhenfeng wang 2015-05-22 02:45:58 UTC
Description of problem:
The hwclock and systemclock of guest should be ccoincident while set a invalid domtime with guest agent

Version-Release number of selected component (if applicable):
libvirt-1.2.15-2.el7.x86_64
kernel-3.10.0-254.el7.x86_64
qemu-kvm-rhev-2.3.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Configure a guest with guest agent
#virsh dumpxml 7.2
--
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/7.2.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
--

2.Start the guest
#virsh start 7.2

3.Check the domtime of the guest
# virsh domtime 7.2 --pretty
Time: 2015-04-27 02:46:11

4.Set the domtime with a big value, will report an error. However, check the domtime, found the guest's time changed actually.
# virsh domtime 7.2 3999999999
error: internal error: unable to execute QEMU agent command 'guest-set-time': hwclock failed to set hardware clock to system time

# virsh domtime 7.2 --pretty
Time: 2096-10-02 07:06:42

7.Check the hwclock and system time inside the guest, we could find that only the system time changed, the hardware time didn't change
guest# hwclock
Mon 27 Apr 2015 10:49:29 AM CST  -0.920839 seconds
guest# date
Tue Oct  2 15:09:44 CST 2096
guest# date -u
Tue Oct  2 07:09:47 UTC 2096

Actual results:
while set the domtime with a big value, will report an error , however, check the domtime, found the guest's time changed actually

Expected results:
The hwclock and systemclock of guest should be ccoincident while set a invalid domtime with guest agent

Additional info:

Comment 2 Marc-Andre Lureau 2015-07-05 14:41:47 UTC
You can't set hwtime >= 2070, this is a known system limit (1970 +100)

Linux drivers/char/rtc.c
                /* These limits and adjustments are independent of
                 * whether the chip is in binary mode or not.
                 */
                if (yrs > 169) {
                        spin_unlock_irq(&rtc_lock);
                        return -EINVAL;
                }

I think the agent should bail out earlier, so I sent a patch for that upstream:
https://lists.nongnu.org/archive/html/qemu-devel/2015-07/msg01073.html

Comment 3 Miroslav Rezanina 2015-09-11 05:53:38 UTC
Fix included in qemu-guest-agent-2.3.0-4.el7

Comment 5 huiqingding 2015-09-18 05:08:35 UTC
Reproduce this bug using the version:
qemu-kvm-rhev-2.3.0-23.el7.x86_64
kernel-3.10.0-314.el7.x86_64
qemu-kvm-rhev-2.3.0-1.el7.x86_64


Steps to Reproduce:
1.Configure a guest with guest agent
#virsh dumpxml rhel7.2
--
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/7.2.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
--

2.Start the guest
#virsh start rhel7.2

3.Check the domtime of the guest
# virsh domtime rhel7.2 --pretty
Time: 2015-09-18 04:46:16

4.Set the domtime with a big value, will report an error. However, check the domtime, found the guest's time changed actually.
# virsh domtime rhel7.2 3999999999
error: internal error: unable to execute QEMU agent command 'guest-set-time': hwclock failed to set hardware clock to system time

# virsh domtime 7.2 --pretty
Time: 2096-10-02 07:06:53

7.Check the hwclock and system time inside the guest, we could find that only the system time changed, the hardware time didn't change
guest# hwclock
Fri 18 Sep 2015 12:47:34 PM CST  -0.444511 seconds
guest# date
Tue Oct  2 15:07:29 CST 2096
guest# date -u
Tue Oct  2 07:07:35 UTC 2096

Comment 6 huiqingding 2015-09-18 05:12:34 UTC
Verify this bug using the version:
qemu-kvm-rhev-2.3.0-23.el7.x86_64
kernel-3.10.0-314.el7.x86_64
qemu-kvm-rhev-2.3.0-4.el7.x86_64

The test steps are same as comment #5.
1.Configure a guest with guest agent
#virsh dumpxml rhel7.2
--
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/7.2.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
--

2.Start the guest
#virsh start rhel7.2

3.Check the domtime of the guest
# virsh domtime rhel7.2 --pretty
Time: 2015-09-18 05:04:30

4.Set the domtime with a big value, will report an error. However, check the domtime, found the guest's time did not changed.
# virsh domtime rhel7.2 3999999999
error: internal error: unable to execute QEMU agent command 'guest-set-time': Invalid time

# virsh domtime 7.2 --pretty
Time: 2015-09-18 05:05:02

7.Check the hwclock and system time inside the guest, we could find that the system time and the hardware time didn't change
guest# hwclock
Fri 18 Sep 2015 01:05:16 PM CST  -0.453719 seconds
guest# date
Fri Sep 18 13:05:13 CST 2015

Based on the above results, I think this bug has been fixed.

Comment 7 juzhang 2015-09-21 03:03:30 UTC
According to comment5 and comment6, set this issue as verified.

Comment 9 errata-xmlrpc 2015-11-19 07:11:28 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://rhn.redhat.com/errata/RHBA-2015-2217.html


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