Theo Band
2012-Jun-28 16:49 UTC
[CentOS] How to configure time on virtual clients using KVM?
I use a CentOS5.8 server with KVM. I have several virtual machines running on it. When I reboot the server (takes 10 minutes) all VMs are saved and correctly restored. The time on the clients is however of by 10 minutes. nptd is running on the clients and that is able to correct this big mismatch. But what I don't understand is that the host does not seem to help the client with it's timekeeping. On a fedora16 machine I can tell that kvm-clock is being used: cat /sys/devices/system/clocksource/clocksource0/available_clocksource kvm-clock tsc acpi_pm cat /sys/devices/system/clocksource/clocksource0/current_clocksource kvm-clock One the centos5 client I can think I see the same: dmesg|grep time.c time.c: Using 1.193182 MHz WALL KVM GTOD KVM timer. If I suspend a client, I see the time is correct just after resume. If I save and restore the time is left at the saved time: ssh valk5 date;virsh save valk5 /var/lib/libvirt/images/save ;sleep 60;virsh restore /var/lib/libvirt/images/save;ssh valk5 date;date Thu Jun 28 18:37:59 CEST 2012 Domain valk5 saved to /var/lib/libvirt/images/save Domain restored from /var/lib/libvirt/images/save Thu Jun 28 18:40:00 CEST 2012 Thu Jun 28 18:41:07 CEST 2012 So my question is, is this intended behaviour? Is there something I can change to kick the time during a restore? A second related question is what happens after a live migrate. I can migrate the VMs to a different machine, but that machine has slightly different specs. I notice that the clock speed is really off (minutes per hour need to be corrected after a live migrate). I guess the client gets a differt CPU clock on the other host. Is there a way to update the client without a reboot? A reboot helps, so I guess some timer calibration takes place then. But that defeats the purpose of a live migrate. Theo