[Why] The RTC time of the virtual machine is not consistent with the time of the host physical machine.
[Info] Before: [root@localhost ~]# timedatectl Local time: Wed 2021-01-13 15:55:01 CST Universal time: Wed 2021-01-13 07:55:01 UTC RTC time: Wed 2021-01-13 07:55:01 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a
After: [root@localhost ~]# timedatectl Local time: Wed 2021-01-13 15:55:55 CST Universal time: Wed 2021-01-13 07:55:55 UTC RTC time: Wed 2021-01-13 15:55:55 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a
Signed-off-by: Yu Chuan 13186087857@163.com --- providers/qemu/kvm.sh | 1 + providers/qemu/pxe.sh | 1 + 2 files changed, 2 insertions(+)
diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index 39a1dc19f112..064fd711c298 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -130,6 +130,7 @@ public_option() -initrd $initrd -smp $nr_cpu -m $memory + -rtc base=localtime -k en-us -no-reboot -nographic diff --git a/providers/qemu/pxe.sh b/providers/qemu/pxe.sh index 8cf198daa639..fa688331964a 100755 --- a/providers/qemu/pxe.sh +++ b/providers/qemu/pxe.sh @@ -28,6 +28,7 @@ kvm=( -cpu Kunpeng-920 -device virtio-gpu-pci -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd + -rtc base=localtime -nic tap,model=virtio-net-pci,helper=/usr/libexec/qemu-bridge-helper,br=br0,mac=${mac} -k en-us -no-reboot