Dmitry E. Mikhailov
d.mikhailov at infocommunications.ru
Wed Jan 2 09:36:16 UTC 2013
On Wed, 2013-01-02 at 00:53 -0800, Robert Dinse wrote:
> Friday, I moved our servers to a new co-lo facility and ran into an
> interesting problem with virtual machines.
> I did an orderly shutdown of the CentOS 6.3 host, and it in turn suspends
> all the guests. It took about an hour and a half to move and fire up the host.
> The guests, being suspended, were then an hour and a half behind and it
> seems ntpd does not want to correct more than 1000 seconds of error so it would
> not automatically adjust the clocks.
> I tried the -g argument which is supposed to override the 1000 second
It is not supposed:
from 'man ntpd':
The -g option overrides this
check and the clock will be set to the server time regardless of
the chip time. However, and to protect against broken hardware, such
as when the CMOS battery fails or the clock counter becomes
defective, once the clock has been set, an error greater than 1000s will
cause ntpd to exit anyway.
So after initial time set ntpd would enforce it's 1000s limit anyway.
More, it would take too much time for ntpd to synchronize an hour
> but it did not. I ended up having to manually set the clocks close
> enough for ntpd to correct.
> Since there is no hardware clock for the virtual machines to use when they
> boot, it seems that shutdown and reboot of the virtual machines probably would
> not have avoided this.
IHMO it would help. There is some emulated hardware clock for a virtual
machine but Linux doesn't use it except for bootup. Otherwize virtual
machine won't get correct time at all. There's the 'hwclock' application
mentioned in init scripts which synchronizes Linux clock to hardware
(hwclock --hctosys) on bootup and does reverse on shutdown (hwclock
--systohc). Obviously in the virtual environment the last command would
be ignored :-).
> Any suggestions for addressing this particular scenerio other than having
> to manually set a bunch of clocks?
Reboot. Or manually stop ntpd and do 'ntpdate'. Or you could manually
try hwclock --hctosys. I'd like to know if it would succeed.
More information about the CentOS-virt