crc icon indicating copy to clipboard operation
crc copied to clipboard

Add libhvee as alternative Hyper-V driver on Windows

Open gbraad opened this issue 2 years ago • 23 comments

Fixes #3811

Basic functionality for:

  • create
  • start
  • stop
  • delete

gbraad avatar Sep 06 '23 10:09 gbraad

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please ask for approval from gbraad. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar Sep 06 '23 10:09 openshift-ci[bot]

rebase broke the build:

Error: pkg\crc\preflight\preflight_checks_windows.go:14:2: cannot find package "." in:
	D:\a\crc\crc\vendor\github.com\crc-org\crc\pkg\crc\constants
Error: pkg\crc\machine\driver_windows.go:7:2: cannot find package "." in:
	D:\a\crc\crc\vendor\github.com\crc-org\crc\pkg\crc\machine\config
Error: pkg\crc\machine\driver_windows.go:8:2: cannot find package "." in:
	D:\a\crc\crc\vendor\github.com\crc-org\crc\pkg\crc\machine\libhvee
Error: pkg\crc\machine\driver_windows.go:9:2: cannot find package "." in:
	D:\a\crc\crc\vendor\github.com\crc-org\crc\pkg\drivers\libhvee
Error: pkg\crc\machine\driver_windows.go:10:2: cannot find package "." in:
	D:\a\crc\crc\vendor\github.com\crc-org\crc\pkg\libmachine
Error: pkg\crc\machine\driver_windows.go:11:2: cannot find package "." in:
	D:\a\crc\crc\vendor\github.com\crc-org\crc\pkg\libmachine\host

and for my local build I get:

go: finding module for package github.com/crc-org/crc/pkg/crc/constants
go: finding module for package github.com/crc-org/crc/pkg/crc/machine/config
go: finding module for package github.com/crc-org/crc/pkg/libmachine
go: finding module for package github.com/crc-org/crc/pkg/drivers/libhvee
go: finding module for package github.com/crc-org/crc/pkg/libmachine/host
go: finding module for package github.com/crc-org/crc/pkg/crc/machine/libhvee
pkg/crc/preflight/preflight_checks_windows.go:14:2: cannot query module due to -mod=vendor
        (Go version in go.mod is at least 1.14 and vendor directory exists.)
pkg/crc/machine/driver_windows.go:7:2: cannot query module due to -mod=vendor
        (Go version in go.mod is at least 1.14 and vendor directory exists.)
pkg/crc/machine/driver_windows.go:8:2: cannot query module due to -mod=vendor
        (Go version in go.mod is at least 1.14 and vendor directory exists.)
pkg/crc/machine/driver_windows.go:9:2: cannot query module due to -mod=vendor
        (Go version in go.mod is at least 1.14 and vendor directory exists.)
pkg/crc/machine/driver_windows.go:10:2: cannot query module due to -mod=vendor
        (Go version in go.mod is at least 1.14 and vendor directory exists.)
pkg/crc/machine/driver_windows.go:11:2: cannot query module due to -mod=vendor
        (Go version in go.mod is at least 1.14 and vendor directory exists.)
make: *** [Makefile:105: out/windows-amd64/crc.exe] Error 1

Not sure what the problem is

$ make vendor
go: github.com/crc-org/crc/v2/pkg/crc/machine imports
        github.com/crc-org/crc/pkg/crc/machine/config: github.com/crc-org/[email protected]: parsing go.mod:
        module declares its path as: github.com/code-ready/crc
                but was required as: github.com/crc-org/crc
make: *** [Makefile:79: vendor] Error 1

???

gbraad avatar Sep 13 '23 07:09 gbraad

These are the results for this PR on windows https://crcqe-asia.s3.amazonaws.com/nightly/ocp/4.13.12/20231005/11-pro/qe-results/e2e-non-ux.xml all green except the known issue with the latest version for the pipelines operator

adrianriobo avatar Oct 05 '23 19:10 adrianriobo

Want to incorporate 9P, but the current codebase for this lives in the PR https://github.com/containers/gvisor-tap-vsock/pull/280

gbraad avatar Oct 06 '23 09:10 gbraad

Want to incorporate 9P, but the current codebase for this lives in the PR containers/gvisor-tap-vsock#280

The code from this gvisor-tap-vsock PR is short, and thus easy to add to the daemon when we need it. But there's also some guest code involved, which might be trickier https://github.com/mheon/libpod/commit/334e213662adcd71097df07e1090db53c03d15f7

cfergeau avatar Oct 06 '23 10:10 cfergeau

@cfergeau it basically is the same/similar code as the 9p-ufs that I tested with earlier, so I am not so concerned. I am more curious if this will therefore be part of a library, or the changes for libpod remain seperate?

gbraad avatar Oct 06 '23 15:10 gbraad

ref: #3870

gbraad avatar Oct 17 '23 06:10 gbraad

This PR needs https://github.com/containers/libhvee/pull/66

gbraad avatar Nov 29 '23 07:11 gbraad

Rebased again, and added support for disk resize in https://github.com/cfergeau/crc/tree/libhvee (untested) Seeing that the branch is in github.com/crc-org, I'll just force push to it instead of keeping my own branch.

cfergeau avatar Dec 07 '23 15:12 cfergeau

Rebasing... (experienced weird issues with branch but should be resolved now)

gbraad avatar Jan 24 '24 08:01 gbraad

This is still WIP, but I've tested that this works, including disk resize. The 9p code needs more work which is described in the relevant commit log.

cfergeau avatar Apr 08 '24 14:04 cfergeau

Given https://github.com/crc-org/crc/issues/3870#issuecomment-2074870282 , I'd punt 9p support for now and work on merging the libhvee code with no changes to the file sharing code.

cfergeau avatar Apr 24 '24 13:04 cfergeau

Given #3870 (comment) , I'd punt 9p support for now and work on merging the libhvee code with no changes to the file sharing code.

Maybe we need to use https://github.com/aperezdc/9pfuse?tab=readme-ov-file or something similar.

cfergeau avatar May 15 '24 08:05 cfergeau

work on merging the libhvee code with no changes to the file sharing code.

Do you mean to target SMB or leave as in the current PR (no support)

gbraad avatar May 15 '24 10:05 gbraad

work on merging the libhvee code with no changes to the file sharing code.

Do you mean to target SMB or leave as in the current PR (no support)

Ideally, use the same SMB support as what we have now. I haven't checked if this PR removes some SMB support, but hopefully it's still there?

cfergeau avatar May 15 '24 10:05 cfergeau

Originally the PR removed it, but part of it is there... just never tested. Note: we have no automated tests for this :-s.

gbraad avatar May 15 '24 10:05 gbraad

Tested this PR on windows and the SMB based file sharing and it is working as expected, have to use the windows MSI installer, then the following config options needs to be set before crc start

$ crc config set host-network-access true
$ crc config set shared-dir-password <login_user_pass>
$ crc config set enable-shared-dir true

anjannath avatar May 21 '24 07:05 anjannath

While testing i also noticed that error messages from the libhvee driver is a bit concise than the older hyperv driver, e.g

from libhvee..

Screenshot_win11_2024-05-21_14:26:15


from hyperv driver

Screenshot_win11_2024-05-21_14:44:07

anjannath avatar May 21 '24 09:05 anjannath

@anjannath this is a side effect of the WMI use. The powershell interface is more verbose, though also not always right. When WMI is used, you only get return codes back from the 'queries' and 'requests' that are performed. This would need to be a refinement in the libhvee library. Perhaps file an issue upstream for this?

gbraad avatar May 29 '24 03:05 gbraad

/me tested and concludes: "works as expected"

gbraad avatar May 29 '24 03:05 gbraad

Everlasting rebasing

gbraad avatar Jun 18 '24 11:06 gbraad

Everlasting rebasing

Rebase done.

cfergeau avatar Jun 18 '24 11:06 cfergeau

@gbraad: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/security 3def9609c0d728890e5c1367cbdf1a3ccf5aa9de link false /test security
ci/prow/integration-crc 3def9609c0d728890e5c1367cbdf1a3ccf5aa9de link true /test integration-crc
ci/prow/e2e-crc 3def9609c0d728890e5c1367cbdf1a3ccf5aa9de link true /test e2e-crc

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-sigs/prow repository. I understand the commands that are listed here.

openshift-ci[bot] avatar Jun 18 '24 13:06 openshift-ci[bot]