[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help with KVM/libvirt/win2008r2. Guest loosing time.



On 8/6/2012 8:11 AM, William Thompson wrote:
> Keep me in CC, I'm not on the list
> 
>>> I have a Win 2008 R2 guest running under KVM controlled by libvirt.  The
>>> guest is loosing time.  I have the clock open on the guest and the
>>> seconds change once every 2-5 seconds.  The guest was started at
>>> 11:45:58.  As of 13:10:30 the guest's time is 12:03:46.
>>>
>>> I have tried various things that I found on google.  Unfortunately, the
>>> sites I found do not work for me.
>>
>> (...)
>>
>> Surely you've already read the wiki tips about time drifts in the guests 
>> but in the event you missed, here it is:
>>
>> http://www.linux-kvm.org/page/FAQ#I.27m_experiencing_timer_drift_issues_in_my_VM_guests.2C_what_to_do.3F
> 
> That talks about linux guests, not windows guests.  Either way, it didn't
> help.

You need to be looking at this from the Windows side as well.  VMware's
vmtools has been shipping for over 7 years.  It includes a client that
runs on Windows guests and keeps the time sync'd to the hypervisor.  I
know of no equivalent Windows client for any Linux hypervisors.  Which
means you need to tweak the Windows kernel to keep time to less than 5
minutes of drift per hour, setup ntpd on the hypervisor host, and point
the Windows guest to that time source IP.

This would be much simpler if the Windows scheduler had more
granularity.  You can only schedule per day or greater.  AFAIK you can't
schedule events every X minutes as with cron.  Maybe there's a cron for
Windows.  I don't have time to look.  If you could do every X minutes,
you'd simply run ntpd in the host, and run a batch file every 5 minutes
containing

w32tm /resync /nowait

to run every 5 minutes, after doing a

c:\> net time /setsntp:host_ip_addr

to tell Windows what ntp server to use.

Find a way to schedule every 5 mins in Windows and your problem is
pretty much solved.

This is exactly how I fixed this problem with Linux guests running on
ESX 2.5/3.0 about 7 years ago.  I tweaked the kernel command lines of
the guests with noapic noacpi clock=pit etc to get the clocks down to
less than 5 minutes of drift per hour, then cron'd ntpdate every 10
minutes.  Eventually I got the guest kernels tuned to less than 3
minutes drift per day and cron'd ntpdate once a day at midnight.

-- 
Stan


Reply to: