Skip to content

Commit

Permalink
Enable QEMU Podman machine on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
  • Loading branch information
arixmkii committed Sep 30, 2023
1 parent cc8c28e commit eb399b8
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 13 deletions.
11 changes: 11 additions & 0 deletions pkg/machine/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ Note: To run specfic test files, add the test files to the end of the winmake co

`./winmake localmachine "basic_test.go start_test.go"`

### QEMU
1. Install QEMU and add it to either user or sysmem PATH variable
1. Install Podman release (needed to have gvproxy binary)
1. Open a powershell as a regular user
1. $env:CONTAINERS_MACHINE_PROVIDER="qemu"
1. `./winmake localmachine`

Note: To run specfic test files, add the test files to the end of the winmake command:

`./winmake localmachine "basic_test.go start_test.go"`

## MacOS

### Apple Hypervisor
Expand Down
14 changes: 14 additions & 0 deletions pkg/machine/e2e/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,17 @@ func isVmtype(vmType machine.VMType) bool {
func isWSL() bool {
return isVmtype(machine.WSLVirt)
}

func getQemuFcosDownloadLocation(p machine.VirtProvider) string {
dd, err := p.NewDownload("")
if err != nil {
Fail("unable to create new download")
}

fcd, err := dd.GetFCOSDownload(defaultStream)
if err != nil {
Fail("unable to get virtual machine image")
}

return fcd.Location
}
13 changes: 1 addition & 12 deletions pkg/machine/e2e/config_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,10 @@ import (
"os/exec"

"github.com/containers/podman/v4/pkg/machine"
. "github.com/onsi/ginkgo/v2"
)

func getDownloadLocation(p machine.VirtProvider) string {
dd, err := p.NewDownload("")
if err != nil {
Fail("unable to create new download")
}

fcd, err := dd.GetFCOSDownload(defaultStream)
if err != nil {
Fail("unable to get virtual machine image")
}

return fcd.Location
return getQemuFcosDownloadLocation(p)
}

func pgrep(n string) (string, error) {
Expand Down
7 changes: 6 additions & 1 deletion pkg/machine/e2e/config_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import (

const podmanBinary = "../../../bin/windows/podman.exe"

func getDownloadLocation(_ machine.VirtProvider) string {
func getDownloadLocation(p machine.VirtProvider) string {
// QemuVirt provider
if p.VMType() == machine.QemuVirt {
return getQemuFcosDownloadLocation(p)
}
// Fallback to default WSLVirt
fd, err := wsl.NewFedoraDownloader(machine.WSLVirt, "", defaultStream.String())
if err != nil {
Fail("unable to get WSL virtual image")
Expand Down
3 changes: 3 additions & 0 deletions pkg/machine/e2e/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ var _ = Describe("podman machine init", func() {
Skip("volumes are not supported on hyperv yet")
}
skipIfWSL("WSL volumes are much different. This test will not pass as is")
if testProvider.VMType() == machine.QemuVirt && runtime.GOOS == "windows" {
Skip("volumes are not yet supported on official qemu builds running under Windows")
}

tmpDir, err := os.MkdirTemp("", "")
Expect(err).ToNot(HaveOccurred())
Expand Down
2 changes: 2 additions & 0 deletions pkg/machine/provider/platform_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ func Get() (machine.VirtProvider, error) {
return wsl.VirtualizationProvider(), nil
case machine.HyperVVirt:
return hyperv.VirtualizationProvider(), nil
case machine.QemuVirt:
return getQemuProvider()
default:
return nil, fmt.Errorf("unsupported virtualization provider: `%s`", resolvedVMType.String())
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/machine/provider/platform_windows_amd64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package provider

import (
"github.com/containers/podman/v4/pkg/machine"
"github.com/containers/podman/v4/pkg/machine/qemu"
)

func getQemuProvider() (machine.VirtProvider, error) {
return qemu.VirtualizationProvider(), nil
}
11 changes: 11 additions & 0 deletions pkg/machine/provider/platform_windows_arm64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package provider

import (
"fmt"

"github.com/containers/podman/v4/pkg/machine"
)

func getQemuProvider() (machine.VirtProvider, error) {
return nil, fmt.Errorf("unsupported virtualization provider: `%s`", machine.QemuVirt.String())
}

0 comments on commit eb399b8

Please sign in to comment.