Wiki . Forums . Bugs . Translation . Privacy Policy | Search . Simple . Advanced | Reports . Help | Matrix . 10.x . 11.x . 12.x . 13.x . Future . Recent . Contribs

Bug 5648 - Adjust NTP operating parameters for running under vmware
Summary: Adjust NTP operating parameters for running under vmware
Status: CLOSED FIXED
Alias: None
Product: SME Server 8.X
Classification: SME Server
Component: e-smith-*/smeserver-* packages (show other bugs)
Version: Unknown
Hardware: --- ---
: P3 normal
Target Milestone: 8.0b6
Assignee: SME Server bug team
QA Contact: SME Server bug team
URL:
Depends on:
Blocks:
 
Reported: 2009-12-03 13:48 CET by Charlie Brady
Modified: 2013-11-05 00:38 CET (History)
5 users (show)

See Also:
Package: ---


Attachments
Support for large drifts (1.87 KB, patch)
2010-06-10 03:10 CEST, Daniel B.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Charlie Brady 2009-12-03 13:48:58 CET
From VMWare knowledge base article:


http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=1006427&sliceId=1&docTypeID=DT_KB_1_1&dialogID=24770738&stateId=1%200%2024774167


NTP Recommendations
Note: In all cases use NTP instead of VMware Tools periodic time synchronization. Also, you may need to open the firewall (UDP 123) to allow NTP traffic.
 
The following is a sample /etc/ntp.conf :
 
tinker panic 0
restrict 127.0.0.1
restrict default kod nomodify notrap
server 0.vmware.pool.ntp.org
server 1.vmware.pool.ntp.org
server 2.vmware.pool.ntp.org
driftfile /var/lib/ntp/drift
 
The following is a sample /etc/ntp/step-tickers :
 
0.vmware.pool.ntp.org
1.vmware.pool.ntp.org
 
The configuration directive tinker panic 0 instructs NTP not to give up if it sees a large jump in time. This is important for coping with large time drifts and also resuming virtual machines from their suspended state.
 
Note: The directive tinker panic 0 must be at the top of the ntp.conf file.
 
It is also important not to use the local clock as a time source, often referred to as the Undisciplined Local Clock. NTP has a tendency to fall back to this in preference to the remote servers when there is a large amount of time drift.
 
An example of such a configuration is:
 
server 127.127.1.0
fudge 127.127.1.0 stratum 10
 
Comment out both lines.
 
After making changes to NTP configuration, the NTP daemon must be restarted. Refer to your operating system vendor’s documentation.
Comment 18 RequestedDeletion 2013-11-05 00:38:30 CET
By default SupportLargeDrift is not (In reply to daniel from comment #3)
> Created attachment 2966 [details]
> Support for large drifts
> 
> This path adds a new db key for ntpd: SupportLargeDrift. Default value is
> disabled, which doesn't change the current behaviour.

FYI: 

By default on SME8 the db ntpd property 'SupportLargeDrift' is _not_ present/initialized as part of an SME8 installation. Of course it can be added manually.

-HF
Comment 17 Ian Wells 2010-12-04 08:27:18 CET
Closing as released as an update 4th December 2010
Comment 16 Ian Wells 2010-11-27 15:32:16 CET
= Environment:
Start with sme8.0Beta6

= Current version installed:

# rpm -q e-smith-ntp
e-smith-ntp-2.2.0-2.el5.sme

= Original problem:

VM guests can take a long time to regain the correct time after resuming from suspended state.


= Resolution:

This path adds a new db key for ntpd: SupportLargeDrift. Default value is
disabled, which doesn't change the current behaviour.

But, if set to enabled, it will
- add tinker panic 0 at the begening of the ntp.conf
- remove the lines

server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10

With SupportLargeDrift enabled, the guest can resync the clock with the configured ntp server, 
even after resuming from a suspended state (tested with a ~10min drift, it took
about 3 or 4 minutes for the guest to resync the clock after resuming).

update e-smith-ntp >= 2.2.0-3
* Tue Oct 12 2010 Daniel Berteaud <daniel@firewall-services.com> 2.2.0-3.sme
- Support large drifts [SME: 5648]

= Problem fixed:

#  rpm -q e-smith-ntp
e-smith-ntp-2.2.0-4.el5.sme

# db configuration setprop ntpd SupportLargeDrift enabled

# db configuration show ntpd
ntpd=service
    MemLimit=12000000
    NTPServer=smeserver.pool.ntp.org
    SupportLargeDrift=enabled
    SyncToHWClockSupported=yes
    status=enabled

# expand-template /etc/ntp.conf

reboot

Compare before and after:

Two SME8 VMs suspended at Sat Nov 27 22:07:39 GMT 2010
one with e-smith-ntp-2.2.0-2, and one with e-smith-ntp-2.2.0-4 and SupportLargeDrift=enabled
-- wait a while (~10 min) --

Resume both VMs

e-smith-ntp-2.2.0-4 and SupportLargeDrift=enabled
2010-11-27 22:21:59.679223500 27 Nov 22:15:27 ntpd[3127]: synchronized to 192.121.13.58, stratum 2
2010-11-27 22:21:59.679225500 27 Nov 22:21:59 ntpd[3127]: time reset +391.846874 s
2010-11-27 22:21:59.679225500 27 Nov 22:21:59 ntpd[3127]: kernel time sync enabled 0001

e-smith-ntp-2.2.0-2
2010-11-27 22:10:32.635834500 27 Nov 22:10:32 ntpd[3075]: synchronized to LOCAL(0), stratum 10
2010-11-27 22:10:32.635839500 27 Nov 22:10:32 ntpd[3075]: kernel time sync enabled 0001
2010-11-27 22:15:54.689132500 27 Nov 22:15:54 ntpd[3075]: synchronized to 81.171.44.131, stratum 2
...
30 min later still not in sync

= Release note information suggestion:

Enable speedier time synchronisation for suspended VMs

= Verified or Reopen:

Marking VERIFIED
Comment 15 Daniel B. 2010-10-12 00:20:49 CEST
Fixed in e-smith-ntp-2.2.0-3:

%changelog
* Tue Oct 12 2010 Daniel Berteaud <daniel@firewall-services.com> 2.2.0-3.sme
- Support large drifts [SME: 5648]
Comment 14 Shad L. Lords 2010-10-08 10:51:33 CEST
back to new.  If someone is actively working on something then switch it to assigned.
Comment 13 Charlie Brady 2010-06-17 17:08:07 CEST
(In reply to comment #12)
> Justification is that it makes my life easier in maintaining and developing SME
> Server which I do on VMs. 

Sounds reasonable.

> The default is disabled so has no affect on normal
> users.

As long as we validate carefully that it has no effect on non-VM servers then I have no problem with this.
Comment 12 Ian Wells 2010-06-17 17:00:02 CEST
(In reply to comment #11)
> (In reply to comment #10)
> 
> > It would also be useful for SME7, I can clone it.
> 
> I don't think this should go into SME7 unless there is strong justification,
> and until it is well proven with SME8.

Justification is that it makes my life easier in maintaining and developing SME Server which I do on VMs. The default is disabled so has no affect on normal users. Of course I can use a custom template but that is not a good option when doing verification.

As the use of VMs grow this becomes more important to more people.

I can commit the SME8 version first although I have the SME7 version in use.
Comment 11 Charlie Brady 2010-06-17 16:53:40 CEST
(In reply to comment #10)

> It would also be useful for SME7, I can clone it.

I don't think this should go into SME7 unless there is strong justification, and until it is well proven with SME8.
Comment 10 Ian Wells 2010-06-17 16:43:46 CEST
I'm checking and will commit Daniel's patch.
It would also be useful for SME7, I can clone it.
It works well on my VMs
Comment 9 Daniel B. 2010-06-15 06:33:01 CEST
(In reply to comment #8)
> 
> AFAICT xen does, so and I see no reason why other hypervisors should not. My
> SME Server test machines, running as XEN guests, that have been powered off for
> a while all do have the current time after booting, without modifications to
> any ntpd files.

Of course the clock is correct at boot time, with KVM too. We're talking here about resuming a suspended VM.
Comment 8 Jonathan 2010-06-15 06:28:46 CEST
(In reply to comment #7)
> The VM has no way to do that, and no business doing that anyway. The "guest
> time" is just a variable in RAM. The VM has no way of knowing its address, and
> shouldn't be changing it anyway.

AFAICT xen does, so and I see no reason why other hypervisors should not. My SME Server test machines, running as XEN guests, that have been powered off for a while all do have the current time after booting, without modifications to any ntpd files.
Comment 7 Charlie Brady 2010-06-14 06:54:06 CEST
(In reply to comment #6)

> IMHO the restore process should somehow
> calculate the difference between stop and start time and increment the guest
> clock.

The VM has no way to do that, and no business doing that anyway. The "guest time" is just a variable in RAM. The VM has no way of knowing its address, and shouldn't be changing it anyway.
Comment 6 Jonathan 2010-06-13 12:29:08 CEST
(In reply to comment #5)
> When resuming, a new qemu/kvm process starts and the dumped memory is injected.
> for the guest POV, nothing happened. The only way for the guest OS to sync its
> clock, is to use NTP (and the proposed change allow ntp to adjust the clock
> even if there's a big drift).

I think this is a bug in qemu/KVM. IMHO the restore process should somehow calculate the difference between stop and start time and increment the guest clock.

Perhaps along the way of the scenario described in this bug, concerning time sync over migration: https://bugzilla.redhat.com/show_bug.cgi?id=531701

Although we might have a work-around, which we can document, I think it would be better that you report this in RedHat bug tracker to improve the product.
Comment 5 Daniel B. 2010-06-13 11:13:00 CEST
(In reply to comment #4)
> 
> IMHO this is a work-around and not a solution. Why does the system clock stop
> on a suspend? Normal OS-es seem not to do so, or at least seem able to resume
> the clock at the proper position. Are we sure this is not a bug with the hyper
> visor used?

I don't know how other hypervisor works, but at least with qemu/kvm, the guest has no way to know it has been suspended: the VM is a process on the host, when suspending, this process is freezed, the guest memory is dumped to a file on the host, and the process is killed.

When resuming, a new qemu/kvm process starts and the dumped memory is injected. for the guest POV, nothing happened. The only way for the guest OS to sync its clock, is to use NTP (and the proposed change allow ntp to adjust the clock even if there's a big drift).
Comment 4 Jonathan 2010-06-10 03:21:42 CEST
(In reply to comment #3)
> I've just tested on a KVM based virtual machine. With SupportLargeDrift
> enabled, the guest can resync the clock with the configured ntp server, even
> after resuming from a suspended state (tested with a ~10min drift, it took
> about 3 or 4 minutes for the guest to resync the clock after resuming).

IMHO this is a work-around and not a solution. Why does the system clock stop on a suspend? Normal OS-es seem not to do so, or at least seem able to resume the clock at the proper position. Are we sure this is not a bug with the hyper visor used?
Comment 3 Daniel B. 2010-06-10 03:10:07 CEST
Created attachment 2966 [details]
Support for large drifts

This path adds a new db key for ntpd: SupportLargeDrift. Default value is disabled, which doesn't change the current behaviour.

But, if set to enabled, it will
- add tinker panic 0 at the begening of the ntp.conf
- remove the lines

server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10


I've just tested on a KVM based virtual machine. With SupportLargeDrift enabled, the guest can resync the clock with the configured ntp server, even after resuming from a suspended state (tested with a ~10min drift, it took about 3 or 4 minutes for the guest to resync the clock after resuming).

were you thinking of something like this Charly ?
Comment 2 Michael McCarn 2009-12-05 09:30:41 CET
(In reply to comment #1)
> Change the ntp polling frequency:
>  config setprop ntpd NTPServer north-america.pool.ntp.org

I meant to type:
  config setprop ntpd NTPServer "north-america.pool.ntp.org minpoll 4 maxpoll 8"
Comment 1 Michael McCarn 2009-12-05 09:29:29 CET
In case it helps -

I have a vmware SME server that has been running since 2006 with no time problems, configured as described in this post: http://forums.contribs.org/index.php/topic,32139.msg139191.html#msg139191:

Modify /boot/grub/grub.conf, adding the following clock info to each "kernel" line:
  clock=pmtmr nosmp noapic nolapic
The currently active kernel line looks like this:
  kernel /vmlinuz-2.6.9-78.0.22.ELsmp ro root=/dev/main/root clock=pmtmr nosmp noapic nolapic

Disable the hardware clock:
 mkdir -p /etc/e-smith/templates-custom/etc/ntp.conf
 echo \# Disable the local hardware clock > /etc/e-smith/templates-custom/etc/ntp.conf/10localhost

Change the ntp polling frequency:
 config setprop ntpd NTPServer north-america.pool.ntp.org
 expand-template /etc/ntp.conf
 signal-event reboot

ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*209.167.68.100  65.212.71.102    2 u   43   64  377   37.131  -12.061  22.618
+209.104.4.227   216.218.254.202  2 u   59   64  377   97.084  -14.861  21.114
-206.251.36.39   69.31.45.60      3 u   46   64  377   23.641  -32.465  33.601
+173.8.198.243   131.107.13.100   2 u    5   64  377  100.787  -12.201  13.152