Complete disabling of time synchronization between the virtual machine and the VMware ESXi hypervisor

    A small but rather useful article. Hope it helps someone avoid problems in future.
    Recently, one of our projects experienced an unexpected storm of incidents caused by time out of sync between virtual machines and NTP servers. The reason was found quite quickly: at this time there was a massive online migration of vMotion between hosts, caused by updating the BIOS of hypervisors. Moreover, the hosts also received time from the NTP server, but the virtual machines began to migrate to them immediately after turning on the hypervisors, when the latter did not have time to completely synchronize the time, so there was a time difference between the hosts between which the migration took place. Obviously, this was a mistake on the part of the virtualization team, however it caused a storm of incidents on us, the UNIX team.

    The situation caused great surprise, because the “Synchronize time with host” setting was disabled on all virtual machines. The reason was found in VMware KB :
    The following lines deserve special attention:
    In the VMware Tools control panel, the time synchronization checkbox is unselected, but you may experience these symptoms:
    • When you suspend a virtual machine, the next time you resume that virtual machine it synchronizes the time to adjust it to the host.
    • Time is resynchronized when you migrate the virtual machine using vMotion, take a snapshot, restore to a snapshot, shrink the virtual disk, or restart the VMware Tools service in the virtual machine (including rebooting the virtual machine).

    That's so unexpected. It turns out that Vmvarya forcibly synchronizes time during migration, removing snapshots and in other "special" cases. If there is a time difference between the two hosts and you are migrating a virtual machine between them, this time difference will affect the system clock, which can lead to known problems with ntpd.

    And finally, the most important thing for which I wrote an article: in the same article, it says about how to permanently get rid of this problem - you need to make certain settings for the properties of each virtual machine, namely, make changes to the virtual machine vmx file:
    tools.syncTime = "0"
    time.synchronize.continue = "0"
    time.synchronize.restore = "0"
    time.synchronize.resume.disk = "0"
    time.synchronize.shrink = "0"
    time.synchronize.tools .startup = "0"
    time.synchronize.tools.enable = "0"
    time.synchronize.resume.host = "0"

    The same can be done through the vSphere Client interface.
    Thus, you can protect yourself from any incorrect time settings on the side of hypervisors caused by the human factor or objective reasons.

    Also popular now: