Documentation
¶
Index ¶
- Constants
- Variables
- func InitTPMConfig(ctx context.Context, svcCfg *ServiceConfig) error
- type Config
- type ConfigSwitchType
- type LinkConfig
- type Service
- type ServiceConfig
- type SwitchConfig
- type VM
- func (vm *VM) OnieEepromConfig() (string, error)
- func (vm *VM) Prepare(ctx context.Context, svcCfg *ServiceConfig) error
- func (vm *VM) Run(ctx context.Context, eg *errgroup.Group, svcCfg *ServiceConfig)
- func (vm *VM) RunInstall(ctx context.Context, svcCfg *ServiceConfig) func() error
- func (vm *VM) RunTPM(ctx context.Context, svcCfg *ServiceConfig) func() error
- func (vm *VM) RunVM(ctx context.Context, svcCfg *ServiceConfig) func() error
- func (vm *VM) UUID() string
- type VMConfig
- type VMInterface
- type VMManager
- type VMType
- type VMsConfig
Constants ¶
View Source
const ( HHFAB_CFG_PREFIX = ".hhfab.fabric.githedgehog.com" HHFAB_CFG_TYPE = "type" + HHFAB_CFG_PREFIX HHFAB_CFG_SERIAL = "serial" + HHFAB_CFG_PREFIX HHFAB_CFG_LINK_PREFIX = "link" + HHFAB_CFG_PREFIX + "/" HHFAB_CFG_PCI_PREFIX = "pci@" HHFAB_CFG_SERIAL_SCHEME_SSH = "ssh://" HHFAB_CFG_SERIAL_SCHEME_TELNET = "telnet://" )
View Source
const ( MAC_ADDR_TMPL = "0c:20:12:fe:%02d:%02d" // if changing update onie-qcow2-eeprom-edit config too KUBE_PORT = 6443 REGISTRY_PORT = 31000 SSH_PORT_BASE = 22000 IF_PORT_BASE = 30000 IF_PORT_NULL = IF_PORT_BASE + 9000 IF_PORT_VM_ID_MULT = 100 IF_PORT_PORT_ID_MULT = 1 )
View Source
const ( VM_SELECTOR_SSH = "ssh" VM_SELECTOR_ALL = "all" )
View Source
const ( VM_SIZE_DEFAULT = "default" // meaningful VM sizes for dev & testing VM_SIZE_COMPACT = "compact" // minimal working setup, applied on top of default VM_SIZE_FULL = "full" // full setup as specified in requirements and more real switch resources, applied on top of default )
View Source
const (
IFACES_PER_PCI_BRIDGE = 32
)
Variables ¶
View Source
var CompactControlVM = VMConfig{
CPU: 4,
RAM: 4096,
Disk: 50,
}
View Source
var CompactServerVM = VMConfig{
CPU: 1,
}
View Source
var CompactSwitchVM = VMConfig{
CPU: 3,
RAM: 3584,
Disk: 30,
}
View Source
var DefaultControlVM = VMConfig{
CPU: 6,
RAM: 6144,
Disk: 100,
}
View Source
var DefaultServerVM = VMConfig{
CPU: 2,
RAM: 768,
Disk: 10,
}
View Source
var DefaultSwitchVM = VMConfig{
CPU: 4,
RAM: 5120,
Disk: 50,
}
View Source
var FullControlVM = VMConfig{
CPU: 8,
RAM: 16384,
Disk: 250,
}
View Source
var FullServerVM = VMConfig{
RAM: 1024,
}
View Source
var FullSwitchVM = VMConfig{
RAM: 8192,
}
View Source
var RequiredCommands = []string{
"qemu-system-x86_64",
"qemu-img",
"tpm2",
"swtpm_setup",
"ssh",
"scp",
"sudo",
}
View Source
var SSH_QUIET_FLAGS = []string{
"-o", "GlobalKnownHostsFile=/dev/null",
"-o", "UserKnownHostsFile=/dev/null",
"-o", "StrictHostKeyChecking=no",
"-o", "LogLevel=ERROR",
}
View Source
var VM_SIZES = []string{VM_SIZE_DEFAULT, VM_SIZE_COMPACT, VM_SIZE_FULL}
Functions ¶
func InitTPMConfig ¶
func InitTPMConfig(ctx context.Context, svcCfg *ServiceConfig) error
Makes sure that swtpm config is initialized before we start VMs
Types ¶
type Config ¶
type Config struct { VMs VMsConfig `json:"vms,omitempty"` Switches map[string]SwitchConfig `json:"switches,omitempty"` Links map[string]LinkConfig `json:"links,omitempty"` }
type ConfigSwitchType ¶ added in v0.6.0
type ConfigSwitchType string
const ( ConfigSwitchTypeVS ConfigSwitchType = "vs" ConfigSwitchTypeHW ConfigSwitchType = "hw" )
type LinkConfig ¶ added in v0.6.0
type LinkConfig struct {
PCIAddress string `json:"pci,omitempty"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func Load ¶
func Load(cfg *ServiceConfig) (*Service, error)
func (*Service) StartServer ¶
func (*Service) VFIOPCIBindAll ¶ added in v0.6.0
type ServiceConfig ¶ added in v0.6.0
type SwitchConfig ¶ added in v0.6.0
type SwitchConfig struct { Type ConfigSwitchType `json:"type,omitempty"` Serial string `json:"serial,omitempty"` }
type VM ¶
type VM struct { ID int Name string Type VMType Basedir string Config VMConfig Interfaces map[int]VMInterface Ready fileMarker Installed fileMarker }
func (*VM) OnieEepromConfig ¶ added in v0.6.0
func (*VM) RunInstall ¶
func (vm *VM) RunInstall(ctx context.Context, svcCfg *ServiceConfig) func() error
type VMConfig ¶ added in v0.6.0
type VMConfig struct { CPU int `json:"cpu,omitempty"` // in cores RAM int `json:"ram,omitempty"` // in MB Disk int `json:"disk,omitempty"` // in GB }
func (VMConfig) DefaultsFrom ¶ added in v0.6.0
func (VMConfig) OverrideBy ¶ added in v0.6.0
type VMInterface ¶ added in v0.6.0
type VMManager ¶ added in v0.6.0
type VMManager struct {
// contains filtered or unexported fields
}
func NewVMManager ¶ added in v0.6.0
func (*VMManager) LogOverview ¶ added in v0.6.0
func (mngr *VMManager) LogOverview()
Click to show internal directories.
Click to hide internal directories.