Bug 660194

Summary: clock offset='variable' not working correctly
Product: Red Hat Enterprise Linux 6 Reporter: Andrew Cathrow <acathrow>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: dallan, danken, eblake, gren, jdenemar, juzhang, plyons, rbalakri, vbian, xen-maint, yimwang, yoyzhang
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.8.6-1.el6 Doc Type: Bug Fix
Doc Text:
An off-by-one error in a clock variable caused a virtual guest to show incorrect date and time information. This update corrects this error so that date and time information is correctly displayed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:24:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 662046    

Description Andrew Cathrow 2010-12-06 02:35:29 UTC
Tested in libvirt-0.8.1-27.el6.x86_64

Note: I'm pretty sure that the underlying issue is libvirt but just incase.

symptom :
Installing VM in RHEV 2.3 (IC59 build) - with vdsm-4.9-25.el6.x86_64

When I install a VM and get to the set date/time the time and date is off. In this case November 6th 2:25am when it should be 9pm on 5th December.

Looking at VDSM list I see 
  timeOffset = 0

Looking at the libvirt xml from virsh I see 
 <clock offset='variable' adjustment='0'/>

Looking at KVM command line I see 
   -rtc base=2010-11-6T2:0:25 

The VM was started at 21:02pm 5th December according to system clock.

I'm losing a month somewhere ....

Comment 3 Jiri Denemark 2010-12-10 12:08:34 UTC
Fixed upstream by v0.8.6-45-ge37ff20:

commit e37ff2004a891f31016ee747030b88050a83b479
Author: Dan Kenigsberg <danken>
Date:   Mon Dec 6 09:59:30 2010 +0200

    Fix funny off-by-one error in clock-variable
    
    Humans consider January as month #1, while gmtime_r(3) calls it month #0.
    
    While fixing it, render qemu's rtc parameter with leading zeros, as is more
    commonplace.
    
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=660194

Comment 5 wangyimiao 2010-12-24 08:11:43 UTC
verified it PASSED on build :
libvirt-0.8.6-1.el6.x86_64
libvirt-client-0.8.6-1.el6.x86_64
qemu-kvm-0.12.1.2-2.128.el6.x86_64
qemu-img-0.12.1.2-2.128.el6.x86_64
kernel-2.6.32-93.el6.x86_64

Steps:
1.#define a domain xml include that XML.
.............................
  <clock offset='variable' adjustment='0'/>
...............................

2.start that domain
 # virsh start  http_test
Domain http_test started

3.check host time
# date
Fri Dec 24 09:09:15 EST 2010

# clock
Fri 24 Dec 2010 09:09:02 AM EST  -0.828628 seconds

4.Log in guest domain
# date
Fri Dec 24 09:10:53 EST 2010

# clock
Fri 24 Dec 2010 09:10:57 AM EST  -0.548655 seconds


5.
Looking at KVM command line I see 

-rtc base=2010-12-24T14:08:22

Comment 7 Vivian Bian 2011-02-16 04:41:36 UTC
retested with
libvirt-0.8.7-6.el6.x86_64 
qemu-kvm-0.12.1.2-2.144.el6.x86_64
kernel-2.6.32-113.el6.x86_64

[on host]

# date -u
Wed Feb 16 04:34:59 UTC 2011

# virsh dumpxml test1 |grep clock
  <clock offset='variable' adjustment='0'/>

[on guest]
# date -u 
Wed Feb 16 04:36:53 UTC 2011

[look at qemu-kvm process]
rtc base=2011-02-16T04:35:21

According to libvirt.org
variable
    The guest clock will have an arbitrary offset applied relative to UTC

from the above result , we can see the bug is fixed . So set bug status to VERIFIED

Comment 8 Martin Prpič 2011-04-15 14:22:38 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
An off-by-one error in a clock variable caused a virtual guest to show incorrect date and time information. This update addresses this error. Date and time information is now correctly displayed.

Comment 11 Laura Bailey 2011-05-04 05:10:33 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-An off-by-one error in a clock variable caused a virtual guest to show incorrect date and time information. This update addresses this error. Date and time information is now correctly displayed.+An off-by-one error in a clock variable caused a virtual guest to show incorrect date and time information. This update corrects this error so that date and time information is correctly displayed.

Comment 12 errata-xmlrpc 2011-05-19 13:24:44 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0596.html