mirror of
https://github.com/containers/podman.git
synced 2025-06-20 00:51:16 +08:00
Implement machine provider selection
GetSystemDefaultProvider reworked to fetch provider value from the config file. Additional environment variable CONTAINERS_MACHINE_PROVIDER is supported to override the config for testing purposes. Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/containers/storage/pkg/homedir"
|
||||
@ -413,3 +414,20 @@ const (
|
||||
MachineLocal
|
||||
DockerGlobal
|
||||
)
|
||||
|
||||
func ParseVMType(input string, emptyFallback VMType) (VMType, error) {
|
||||
switch strings.TrimSpace(strings.ToLower(input)) {
|
||||
case "qemu":
|
||||
return QemuVirt, nil
|
||||
case "wsl":
|
||||
return WSLVirt, nil
|
||||
case "applehv":
|
||||
return AppleHvVirt, nil
|
||||
case "hyperv":
|
||||
return HyperVVirt, nil
|
||||
case "":
|
||||
return emptyFallback, nil
|
||||
default:
|
||||
return QemuVirt, fmt.Errorf("unknown VMType `%s`", input)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user