8.10. Virtual Machine Timer Management with libvirt
virsh editcommand. See Section 14.6, “Editing a Guest Virtual Machine's configuration file” for details.
<clock>element is used to determine how the guest virtual machine clock is synchronized with the host physical machine clock. The clock element has the following attributes:
offsetdetermines how the guest virtual machine clock is offset from the host physical machine clock. The offset attribute has the following possible values:
Table 8.1. Offset attribute values
Value Description utc The guest virtual machine clock will be synchronized to UTC when booted. localtime The guest virtual machine clock will be synchronized to the host physical machine's configured timezone when booted, if any. timezone The guest virtual machine clock will be synchronized to a given timezone, specified by the
variable The guest virtual machine clock will be synchronized to an arbitrary offset from UTC. The delta relative to UTC is specified in seconds, using the
adjustmentattribute. The guest virtual machine is free to adjust the Real Time Clock (RTC) over time and expect that it will be honored following the next reboot. This is in contrast to
utcmode, where any RTC adjustments are lost at each reboot.
NoteThe value utc is set as the clock offset in a virtual machine by default. However, if the guest virtual machine clock is run with the localtime value, the clock offset needs to be changed to a different value in order to have the guest virtual machine clock synchronized with the host physical machine clock.
timezoneattribute determines which timezone is used for the guest virtual machine clock.
adjustmentattribute provides the delta for guest virtual machine clock synchronization. In seconds, relative to UTC.
Example 8.1. Always synchronize to UTC
<clock offset="utc" />
Example 8.2. Always synchronize to the host physical machine timezone
<clock offset="localtime" />
Example 8.3. Synchronize to an arbitrary timezone
<clock offset="timezone" timezone="Europe/Paris" />
Example 8.4. Synchronize to UTC + arbitrary offset
<clock offset="variable" adjustment="123456" />
8.10.1. timer Child Element for clock
nameis required, all other attributes are optional.
nameattribute dictates the type of the time source to use, and can be one of the following:
Table 8.2. name attribute values
|pit||Programmable Interval Timer - a timer with periodic interrupts.|
|rtc||Real Time Clock - a continuously running timer with periodic interrupts.|
|tsc||Time Stamp Counter - counts the number of ticks since reset, no interrupts.|
|kvmclock||KVM clock - recommended clock source for KVM guest virtual machines. KVM pvclock, or kvm-clock lets guest virtual machines read the host physical machine’s wall clock time.|