NTP And Virtual Guests

Home » CentOS » NTP And Virtual Guests
CentOS 4 Comments

We encountered a problem with respect to KVM virtual host restore and NTP. Specifically, our VM test host was shutdown by an extended power outage and when power returned all of the restored guests were immediately shutdown by ntp because the time differential between the restored systems and that of the ntpd sync servers exceeded the panic threshold.

This is not an acceptable situation so in the absence of something more elegant we are contemplating shutting down ntpd on virtual hosts and scheduling regular ntpd -q from cron instead.

Is there an alternative to this? If not then what would be a recommended scheduling interval?

4 thoughts on - NTP And Virtual Guests

  • Umm, ntp won’t shut down your guests unless you’ve done something
    non-standard. NTP inside the guest will abort because of the time
    difference but the guest will keep running… just with the wrong time.

    See the “-g” option:

    -g Normally, ntpd exits with a message to the system log if the
    offset exceeds the panic threshold, which is 1000 s by default.
    This option allows the time to be set to any value without
    restriction; however, this can happen only once. If the thresh-
    old is exceeded after that, ntpd will exit with a message to
    the system log. This option can be used with the -q and -x
    options. See the tinker command for other options.

  • I have no idea. Perhaps I misunderstood what the ntpd man page
    referred to as a panic.

    If it is not ntpd then I still need to discover some way of ensuring
    that all the KVM guests that were active at the time of a power
    failure automatically come back on line when the KVM host system
    starts up. I cannot find any reference to how this is done.

    Are there any recommended solutions? These systems are on UPS already
    but the power failure duration exceeded the endurance of the the UPS.

  • I know when ntp changes the time drastically (like ntpdate) my vsftpd
    just commits suicide and dies..
    I imagine something like that is going on with the lvm software either
    on the host or the kvm?

    I would suggest turning off ntp before long time shut downs…and (ugh)
    manually going through the host and all vms upon turn on and ntpdate
    them, then turn ntp on, then
    reboot to make it all come back on?

    perhaps a script that turns off ntp, runs ntpdate on host, then on each
    kvm upon reboot?
    this sounds rather scary.

LEAVE A COMMENT