mirror of
https://github.com/containers/podman.git
synced 2025-12-01 18:49:18 +08:00
Machine init --provider
Add the ability for users to override the default provider when creating mahcines. The new flag is `--provider` and allows you to specifiy a valid vmtype for the platform. This PR also removes the previous list test where we tested listing all providers. I added a PR for testing --provider which includes a standard `machine ls` which defaults now to showing all providers. Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
@@ -33,6 +33,12 @@ func Get() (vmconfigs.VMProvider, error) {
|
||||
}
|
||||
|
||||
logrus.Debugf("Using Podman machine with `%s` virtualization provider", resolvedVMType.String())
|
||||
return GetByVMType(resolvedVMType)
|
||||
}
|
||||
|
||||
// GetByVMType takes a VMType (presumably from ParseVMType) and returns the correlating
|
||||
// VMProvider
|
||||
func GetByVMType(resolvedVMType define.VMType) (vmconfigs.VMProvider, error) {
|
||||
switch resolvedVMType {
|
||||
case define.AppleHvVirt:
|
||||
return new(applehv.AppleHVStubber), nil
|
||||
@@ -42,8 +48,8 @@ func Get() (vmconfigs.VMProvider, error) {
|
||||
}
|
||||
return new(libkrun.LibKrunStubber), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported virtualization provider: `%s`", resolvedVMType.String())
|
||||
}
|
||||
return nil, fmt.Errorf("unsupported virtualization provider: `%s`", resolvedVMType.String())
|
||||
}
|
||||
|
||||
func GetAll() []vmconfigs.VMProvider {
|
||||
|
||||
Reference in New Issue
Block a user