mirror of
https://github.com/containers/podman.git
synced 2025-05-17 23:26:08 +08:00

Changes build tags to allow the applehv code to be built for Intel Macs [NO NEW TESTS NEEDED] Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
37 lines
922 B
Go
37 lines
922 B
Go
//go:build !windows && !darwin
|
|
|
|
package provider
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/containers/common/pkg/config"
|
|
"github.com/containers/podman/v4/pkg/machine"
|
|
"github.com/containers/podman/v4/pkg/machine/qemu"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func Get() (machine.VirtProvider, error) {
|
|
cfg, err := config.Default()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
provider := cfg.Machine.Provider
|
|
if providerOverride, found := os.LookupEnv("CONTAINERS_MACHINE_PROVIDER"); found {
|
|
provider = providerOverride
|
|
}
|
|
resolvedVMType, err := machine.ParseVMType(provider, machine.QemuVirt)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
logrus.Debugf("Using Podman machine with `%s` virtualization provider", resolvedVMType.String())
|
|
switch resolvedVMType {
|
|
case machine.QemuVirt:
|
|
return qemu.VirtualizationProvider(), nil
|
|
default:
|
|
return nil, fmt.Errorf("unsupported virtualization provider: `%s`", resolvedVMType.String())
|
|
}
|
|
}
|