mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 15:57:09 +00:00
virtcontainers: introduce hypervisor_darwin
Fixes: #5995 Placeholder skeleton at this point - implementation will be added after basic build refactoring lands. Signed-off-by: Eric Ernst <eric_ernst@apple.com> Signed-off-by: Danny Canter <danny@dcantah.dev>
This commit is contained in:
parent
31abe170fc
commit
9ec8a13985
@ -49,6 +49,9 @@ const (
|
|||||||
// DragonballHypervisor is the Dragonball hypervisor.
|
// DragonballHypervisor is the Dragonball hypervisor.
|
||||||
DragonballHypervisor HypervisorType = "dragonball"
|
DragonballHypervisor HypervisorType = "dragonball"
|
||||||
|
|
||||||
|
// VirtFrameworkHypervisor is the Darwin Virtualization.framework hypervisor
|
||||||
|
VirtframeworkHypervisor HypervisorType = "virtframework"
|
||||||
|
|
||||||
// MockHypervisor is a mock hypervisor for testing purposes
|
// MockHypervisor is a mock hypervisor for testing purposes
|
||||||
MockHypervisor HypervisorType = "mock"
|
MockHypervisor HypervisorType = "mock"
|
||||||
|
|
||||||
@ -84,6 +87,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// In some architectures the maximum number of vCPUs depends on the number of physical cores.
|
// In some architectures the maximum number of vCPUs depends on the number of physical cores.
|
||||||
|
// TODO (dcantah): Find a suitable value for darwin/vfw. Seems perf degrades if > number of host
|
||||||
|
// cores.
|
||||||
var defaultMaxVCPUs = govmm.MaxVCPUs()
|
var defaultMaxVCPUs = govmm.MaxVCPUs()
|
||||||
|
|
||||||
// agnostic list of kernel root parameters for NVDIMM
|
// agnostic list of kernel root parameters for NVDIMM
|
||||||
@ -177,6 +182,9 @@ func (hType *HypervisorType) Set(value string) error {
|
|||||||
case "dragonball":
|
case "dragonball":
|
||||||
*hType = DragonballHypervisor
|
*hType = DragonballHypervisor
|
||||||
return nil
|
return nil
|
||||||
|
case "virtframework":
|
||||||
|
*hType = VirtframeworkHypervisor
|
||||||
|
return nil
|
||||||
case "mock":
|
case "mock":
|
||||||
*hType = MockHypervisor
|
*hType = MockHypervisor
|
||||||
return nil
|
return nil
|
||||||
|
26
src/runtime/virtcontainers/hypervisor_darwin.go
Normal file
26
src/runtime/virtcontainers/hypervisor_darwin.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) 2023 Apple Inc.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
|
||||||
|
package virtcontainers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewHypervisor returns a hypervisor from a hypervisor type.
|
||||||
|
func NewHypervisor(hType HypervisorType) (Hypervisor, error) {
|
||||||
|
switch hType {
|
||||||
|
case VirtframeworkHypervisor:
|
||||||
|
return &virtFramework{}, nil
|
||||||
|
case MockHypervisor:
|
||||||
|
return &mockHypervisor{}, nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("Unknown hypervisor type %s", hType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func availableGuestProtection() (guestProtection, error) {
|
||||||
|
return noneProtection, nil
|
||||||
|
}
|
@ -27,7 +27,6 @@ func generateVMSocket(id string, vmStogarePath string) (interface{}, error) {
|
|||||||
|
|
||||||
// NewHypervisor returns an hypervisor from a hypervisor type.
|
// NewHypervisor returns an hypervisor from a hypervisor type.
|
||||||
func NewHypervisor(hType HypervisorType) (Hypervisor, error) {
|
func NewHypervisor(hType HypervisorType) (Hypervisor, error) {
|
||||||
|
|
||||||
switch hType {
|
switch hType {
|
||||||
case QemuHypervisor:
|
case QemuHypervisor:
|
||||||
return &qemu{}, nil
|
return &qemu{}, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user