mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 04:04:45 +00:00
kata-runtime: add dragonball config check support.
add dragonball config check support. Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
This commit is contained in:
parent
1befbe6738
commit
274598ae56
@ -107,6 +107,8 @@ func setCPUtype(hypervisorType vc.HypervisorType) error {
|
|||||||
fallthrough
|
fallthrough
|
||||||
case "clh":
|
case "clh":
|
||||||
fallthrough
|
fallthrough
|
||||||
|
case "dragonball":
|
||||||
|
fallthrough
|
||||||
case "qemu":
|
case "qemu":
|
||||||
archRequiredCPUFlags = map[string]string{
|
archRequiredCPUFlags = map[string]string{
|
||||||
cpuFlagVMX: "Virtualization support",
|
cpuFlagVMX: "Virtualization support",
|
||||||
|
@ -51,6 +51,7 @@ const (
|
|||||||
clhHypervisorTableType = "clh"
|
clhHypervisorTableType = "clh"
|
||||||
qemuHypervisorTableType = "qemu"
|
qemuHypervisorTableType = "qemu"
|
||||||
acrnHypervisorTableType = "acrn"
|
acrnHypervisorTableType = "acrn"
|
||||||
|
dragonballHypervisorTableType = "dragonball"
|
||||||
|
|
||||||
// the maximum amount of PCI bridges that can be cold plugged in a VM
|
// the maximum amount of PCI bridges that can be cold plugged in a VM
|
||||||
maxPCIBridges uint32 = 5
|
maxPCIBridges uint32 = 5
|
||||||
@ -989,6 +990,30 @@ func newClhHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func newDragonballHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
||||||
|
kernel, err := h.kernel()
|
||||||
|
if err != nil {
|
||||||
|
return vc.HypervisorConfig{}, err
|
||||||
|
}
|
||||||
|
image, err := h.image()
|
||||||
|
if err != nil {
|
||||||
|
return vc.HypervisorConfig{}, err
|
||||||
|
}
|
||||||
|
kernelParams := h.kernelParams()
|
||||||
|
|
||||||
|
return vc.HypervisorConfig{
|
||||||
|
KernelPath: kernel,
|
||||||
|
ImagePath: image,
|
||||||
|
KernelParams: vc.DeserializeParams(strings.Fields(kernelParams)),
|
||||||
|
NumVCPUs: h.defaultVCPUs(),
|
||||||
|
DefaultMaxVCPUs: h.defaultMaxVCPUs(),
|
||||||
|
MemorySize: h.defaultMemSz(),
|
||||||
|
MemSlots: h.defaultMemSlots(),
|
||||||
|
EntropySource: h.GetEntropySource(),
|
||||||
|
Debug: h.Debug,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func newFactoryConfig(f factory) (oci.FactoryConfig, error) {
|
func newFactoryConfig(f factory) (oci.FactoryConfig, error) {
|
||||||
if f.TemplatePath == "" {
|
if f.TemplatePath == "" {
|
||||||
f.TemplatePath = defaultTemplatePath
|
f.TemplatePath = defaultTemplatePath
|
||||||
@ -1022,6 +1047,9 @@ func updateRuntimeConfigHypervisor(configPath string, tomlConf tomlConfig, confi
|
|||||||
case clhHypervisorTableType:
|
case clhHypervisorTableType:
|
||||||
config.HypervisorType = vc.ClhHypervisor
|
config.HypervisorType = vc.ClhHypervisor
|
||||||
hConfig, err = newClhHypervisorConfig(hypervisor)
|
hConfig, err = newClhHypervisorConfig(hypervisor)
|
||||||
|
case dragonballHypervisorTableType:
|
||||||
|
config.HypervisorType = vc.DragonballHypervisor
|
||||||
|
hConfig, err = newDragonballHypervisorConfig(hypervisor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -46,6 +46,9 @@ const (
|
|||||||
// ClhHypervisor is the ICH hypervisor.
|
// ClhHypervisor is the ICH hypervisor.
|
||||||
ClhHypervisor HypervisorType = "clh"
|
ClhHypervisor HypervisorType = "clh"
|
||||||
|
|
||||||
|
// DragonballHypervisor is the Dragonball hypervisor.
|
||||||
|
DragonballHypervisor HypervisorType = "dragonball"
|
||||||
|
|
||||||
// MockHypervisor is a mock hypervisor for testing purposes
|
// MockHypervisor is a mock hypervisor for testing purposes
|
||||||
MockHypervisor HypervisorType = "mock"
|
MockHypervisor HypervisorType = "mock"
|
||||||
|
|
||||||
@ -169,6 +172,9 @@ func (hType *HypervisorType) Set(value string) error {
|
|||||||
case "clh":
|
case "clh":
|
||||||
*hType = ClhHypervisor
|
*hType = ClhHypervisor
|
||||||
return nil
|
return nil
|
||||||
|
case "dragonball":
|
||||||
|
*hType = DragonballHypervisor
|
||||||
|
return nil
|
||||||
case "mock":
|
case "mock":
|
||||||
*hType = MockHypervisor
|
*hType = MockHypervisor
|
||||||
return nil
|
return nil
|
||||||
|
@ -37,6 +37,8 @@ func NewHypervisor(hType HypervisorType) (Hypervisor, error) {
|
|||||||
return &Acrn{}, nil
|
return &Acrn{}, nil
|
||||||
case ClhHypervisor:
|
case ClhHypervisor:
|
||||||
return &cloudHypervisor{}, nil
|
return &cloudHypervisor{}, nil
|
||||||
|
case DragonballHypervisor:
|
||||||
|
return &mockHypervisor{}, nil
|
||||||
case MockHypervisor:
|
case MockHypervisor:
|
||||||
return &mockHypervisor{}, nil
|
return &mockHypervisor{}, nil
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user