mirror of
				https://github.com/containers/podman.git
				synced 2025-11-01 02:42:11 +08:00 
			
		
		
		
	 6b02c4894b
			
		
	
	6b02c4894b
	
	
	
		
			
			this is the second provider done (qemu first). all tests pass on arm64 hardware locally ... the hybrid pull from oci registries limit this to arm64 only. calling gvproxy, waiting for it, and then vfkit seems to still be problematic. this would be an area that should be cleaned up once all providers are implemented. Signed-off-by: Brent Baude <bbaude@redhat.com>
		
			
				
	
	
		
			36 lines
		
	
	
		
			958 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			958 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package provider
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 	"os"
 | |
| 
 | |
| 	"github.com/containers/common/pkg/config"
 | |
| 	"github.com/containers/podman/v4/pkg/machine/applehv"
 | |
| 	"github.com/containers/podman/v4/pkg/machine/define"
 | |
| 	"github.com/containers/podman/v4/pkg/machine/vmconfigs"
 | |
| 	"github.com/sirupsen/logrus"
 | |
| )
 | |
| 
 | |
| func Get() (vmconfigs.VMProvider, 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 := define.ParseVMType(provider, define.AppleHvVirt)
 | |
| 	if err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 
 | |
| 	logrus.Debugf("Using Podman machine with `%s` virtualization provider", resolvedVMType.String())
 | |
| 	switch resolvedVMType {
 | |
| 	case define.AppleHvVirt:
 | |
| 		return new(applehv.AppleHVStubber), nil
 | |
| 	default:
 | |
| 		return nil, fmt.Errorf("unsupported virtualization provider: `%s`", resolvedVMType.String())
 | |
| 	}
 | |
| }
 |