mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-04 15:04:25 +01:00
Add vm factory support per design in the VM Factory plugin section. The vm factory controls how a new vm is created: 1. direct: vm is created directly 2. template: vm is created via vm template. A template vm is pre-created and saved. Later vm is just a clone of the template vm so that they readonly share a portion of initial memory (including kernel, initramfs and the kata agent). CPU and memory are hot plugged when necessary. 3. cache: vm is created via vm caches. A set of cached vm are pre-created and maintained alive. New vms are created by just picking a cached vm. CPU and memory are hot plugged when necessary. Fixes: #303 Signed-off-by: Peng Tao <bergwolf@gmail.com>
25 lines
739 B
Go
25 lines
739 B
Go
// Copyright (c) 2018 HyperHQ Inc.
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package base
|
|
|
|
import vc "github.com/kata-containers/runtime/virtcontainers"
|
|
|
|
// FactoryBase is vm factory's internal base factory interfaces.
|
|
// The difference between FactoryBase and Factory is that the Factory
|
|
// also handles vm config validation/comparison and possible CPU/memory
|
|
// hotplugs. It's better to do it at the factory level instead of doing
|
|
// the same work in each of the factory implementations.
|
|
type FactoryBase interface {
|
|
// Config returns base factory config.
|
|
Config() vc.VMConfig
|
|
|
|
// GetBaseVM returns a paused VM created by the base factory.
|
|
GetBaseVM() (*vc.VM, error)
|
|
|
|
// CloseFactory closes the base factory.
|
|
CloseFactory()
|
|
}
|