Almost every Linux guest expects the motherboard Real Time Clock (RTC) to be set to UTC and they adjust the time displayed based on their timezone (which may be different for each user).
Most Windows guests expect the RTC to be set to the local time. Windows can be configured to use a UTC clock. We can detect this by looking at the Windows registry. To cope with this difference we need to add a guestcaps flag based on what we think the guest is expecting. (We might also use the source hypervisor RTC setting, but it is not thought to be as reliable as inspecting the guest.) This change simply adds the flag to guestcaps, and sets it to always true, so there is no change to the output. Reviewed-by: Laszlo Ersek <ler...@redhat.com> --- lib/types.mli | 5 +++++ convert/convert_linux.ml | 1 + convert/convert_windows.ml | 1 + lib/types.ml | 3 +++ 4 files changed, 10 insertions(+) diff --git a/lib/types.mli b/lib/types.mli index 65ef2e35cf..3446bb64bd 100644 --- a/lib/types.mli +++ b/lib/types.mli @@ -277,6 +277,11 @@ type guestcaps = { gcaps_virtio_1_0 : bool; (** The guest supports the virtio devices that it does at the virtio-1.0 protocol level. *) + + gcaps_rtc_utc : bool; + (** Is the RTC set to UTC ([true]) or localtime ([false])? For + Linux guests this is always true. For Windows we find out + what the guest is expecting by looking at the registry. *) } (** Guest capabilities after conversion. eg. Was virtio found or installed? *) diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml index 8d7020848f..bd54568b10 100644 --- a/convert/convert_linux.ml +++ b/convert/convert_linux.ml @@ -220,6 +220,7 @@ let convert (g : G.guestfs) source inspect i_firmware _ keep_serial_console _ = gcaps_arch = Utils.kvm_arch inspect.i_arch; gcaps_arch_min_version = arch_min_version; gcaps_virtio_1_0 = virtio_1_0; + gcaps_rtc_utc = true; (* almost all Linux expect RTC to be UTC *) } in guestcaps diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index 122d95469d..7e3aa8d789 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -275,6 +275,7 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips = gcaps_arch = Utils.kvm_arch inspect.i_arch; gcaps_arch_min_version = 0; gcaps_virtio_1_0 = virtio_win_installed.Inject_virtio_win.virtio_1_0; + gcaps_rtc_utc = true; } in guestcaps diff --git a/lib/types.ml b/lib/types.ml index 75c14fd4f6..d6f9a266c5 100644 --- a/lib/types.ml +++ b/lib/types.ml @@ -399,6 +399,7 @@ type guestcaps = { gcaps_arch : string; gcaps_arch_min_version : int; gcaps_virtio_1_0 : bool; + gcaps_rtc_utc : bool; } and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 @@ -429,6 +430,7 @@ let string_of_guestcaps gcaps = gcaps_arch = %s\n\ gcaps_arch_min_version = %d\n\ gcaps_virtio_1_0 = %b\n\ + gcaps_rtc_utc = %b\n\ " (string_of_block_type gcaps.gcaps_block_bus) (string_of_net_type gcaps.gcaps_net_bus) @@ -440,6 +442,7 @@ let string_of_guestcaps gcaps = gcaps.gcaps_arch gcaps.gcaps_arch_min_version gcaps.gcaps_virtio_1_0 + gcaps.gcaps_rtc_utc type target_buses = { target_virtio_blk_bus : target_bus_slot array; -- 2.41.0 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs