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
vfkit: Enable timesync #3416
vfkit: Enable timesync #3416
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfergeau The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
To test this, you need these podman bundles https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/pr-logs/pull/crc-org_snc/595/pull-ci-crc-org-snc-podman-e2e-snc/1588460383008460800/artifacts/e2e-snc/gather-snc/artifacts/bundles.txt |
pkg/drivers/vfkit/driver_darwin.go
Outdated
// when loading a VM created by a crc version predating this commit, | ||
// d.VsockQemuGAPort will be missing from ~/.crc/machines/crc/config.json | ||
// In such a case, assume the VM will not support time sync | ||
if d.VsockQemuGAPort != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense...
perhaps something that can also be detected in the main binary ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to detect it there, having a workaround for crc's behaviour in vfkit's code would be odd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that you can't report back from the driver that this isn't possible.
We would like to inform the user about this error in some form... or we assume this will never happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's something specific to the machine driver. With an older crc, you run crc start; crc stop
, the machine driver state is serialized to json, and does not contain a VsockQemuGAPort
field because this did not exist when it was built.
Then crc start
is ran with a new crc build which looks for VsockQemuGAPort
in the serialized json. It will get 0 instead of the expected value since the field was not present.
pkg/drivers/vfkit/driver_darwin.go
Outdated
// d.VsockQemuGAPort will be missing from ~/.crc/machines/crc/config.json | ||
// In such a case, assume the VM will not support time sync | ||
if d.VsockQemuGAPort != 0 { | ||
timesync, err := client.TimeSyncNew(d.VsockQemuGAPort) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the device we add is not really timesync, but the guest agent. timesyncing is just one (only) of the features used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's more 'timesync' than just guest agent. The guest agent connection is not exposed externally, it's a net.Conn instance internal to vfkit. And vfkit monitors for wake up events, and sends a set-time $current_time
command to the guest agent if present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that is the case, naming should represent that; GuestAgentForTimesync
in some form inside the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe VsockQemuGAPort
-> VsockTimesyncPort
?
this is not available for downloading anymore it seems, getting error when visiting the bundle links from the file
|
This branch has the code for host->guest time synchronization.
It's currently hardcoded in the libvirt and vfkit drivers. This centralizes its value in a single place
On macOS, after a host suspend, the guest clock will be out of sync. vfkit has a --timesync feature, which resyncs the guest clock when the host comes out of sleep. This commit makes use of it.
@cfergeau: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Created bundle manually and tested it, works as expected. Without this PR (current main), time skew happens
With this PR
|
On macOS, after a host suspend, the guest clock will be out of sync.
vfkit 0.0.4 has a --timesync feature, which resyncs the guest clock when the
host comes out of sleep. This PR makes use of it.