Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default time zone for WCOW UVM #1192

Merged
merged 1 commit into from
Nov 18, 2021
Merged

Conversation

dcantah
Copy link
Contributor

@dcantah dcantah commented Oct 6, 2021

For the v2 hcs code paths it seems the only time a time zone is set is if
a new field on the guest connection settings is present (which we don't have)
while using the internal guest connection (shim -> hcs -> gcs). Otherwise
the guest is just left without a time zone set, so things like tzutil or
the get-timezone powershell cmdlet will return an invalid time zone set.
We swapped to always using the external guest connection we maintain in the
shim so we need to set a time zone explicitly.

This change issues a request to the gcs to set a timezone via the same method that
hcs uses internally. It sets the guests time zone to whatever is present on
the host which is the docker behavior, and then all containers in the vm
should inherit this. If the container wants to change its timezone it can
do so if it's on a supported sku.

See https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/virtual-time-zone

Signed-off-by: Daniel Canter dcanter@microsoft.com

@dcantah dcantah force-pushed the timezone_wcow branch 2 times, most recently from ef3ad3a to 570cb77 Compare October 8, 2021 13:43
@dcantah dcantah marked this pull request as ready for review October 8, 2021 13:44
@dcantah dcantah requested a review from a team as a code owner October 8, 2021 13:44
@katiewasnothere katiewasnothere self-assigned this Oct 8, 2021
@dcantah dcantah marked this pull request as draft October 8, 2021 18:53
@dcantah
Copy link
Contributor Author

dcantah commented Oct 8, 2021

Gonna draft again until I can get something answered

@helsaawy helsaawy self-assigned this Nov 10, 2021
@dcantah dcantah marked this pull request as ready for review November 11, 2021 10:40
StandardName: "GMT Standard Time",
StandardBias: 0,
DaylightName: "GMT Daylight Time",
DaylightBias: -60,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mentioned also finding info on a "UTC" time zone. Did that one have DST? I would rather we use something that doesn't have DST if we can find a good standard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not iirc, I'm working to swap it over and rebase this PR right now

Copy link
Contributor Author

@dcantah dcantah Nov 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, using UTC now instead.

@dcantah dcantah force-pushed the timezone_wcow branch 2 times, most recently from e441028 to c672838 Compare November 12, 2021 02:38
@dcantah
Copy link
Contributor Author

dcantah commented Nov 12, 2021

I've sinned and force pushed, but to be fair this is the first time it's been out of draft for review 😝

For the v2 hcs code paths it seems the only time a time zone is set is if
a new field on the guest connection settings is present (which we don't have)
while using the internal guest connection (shim -> hcs -> gcs). Otherwise
the guest is just left without a time zone set, so things like tzutil or
the get-timezone powershell cmdlet will return an invalid time zone set.
We swapped to always using the external guest connection we maintain in the
shim so we need to set a time zone explicitly.

This change issues a request to the gcs to set a timezone via the same method that
hcs uses internally. It sets the guests time zone to whatever is present on
the host which is the docker behavior, and then all containers in the vm
should inherit this. Additionally expose an option to override this behavior and
just set the time zone to GMT. If the container wants to change its timezone
to something else, it is free to on supported images.

See https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/virtual-time-zone

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
@dcantah
Copy link
Contributor Author

dcantah commented Nov 12, 2021

Fixing merge conflicts after Amit's chronyd change got in

@helsaawy
Copy link
Contributor

lgtm

@dcantah dcantah merged commit 0f39fc7 into microsoft:master Nov 18, 2021
princepereira pushed a commit to princepereira/hcsshim that referenced this pull request Aug 29, 2024
For the v2 hcs code paths it seems the only time a time zone is set is if
a new field on the guest connection settings is present (which we don't have)
while using the internal guest connection (shim -> hcs -> gcs). Otherwise
the guest is just left without a time zone set, so things like tzutil or
the get-timezone powershell cmdlet will return an invalid time zone set.
We swapped to always using the external guest connection we maintain in the
shim so we need to set a time zone explicitly.

This change issues a request to the gcs to set a timezone via the same method that
hcs uses internally. It sets the guests time zone to whatever is present on
the host which is the docker behavior, and then all containers in the vm
should inherit this. Additionally expose an option to override this behavior and
just set the time zone to UTC. If the container wants to change its time zone
to something else, it is free to on supported images.

See https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/virtual-time-zone

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants