qemu

package
v0.3.9-2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	OS_NAME_LINUX   = "Linux"
	OS_NAME_WINDOWS = "Windows"
	OS_NAME_MACOS   = "macOS"
	OS_NAME_ANDROID = "Android"
	OS_NAME_VMWARE  = "VMWare"
	OS_NAME_CIRROS  = "Cirros"
	OS_NAME_OPENWRT = "OpenWrt"

	MODE_READLINE = "readline"
	MODE_CONTROL  = "control"

	DISK_DRIVER_VIRTIO = "virtio"
	DISK_DRIVER_SCSI   = "scsi"
	DISK_DRIVER_PVSCSI = "pvscsi"
	DISK_DRIVER_IDE    = "ide"
	DISK_DRIVER_SATA   = "sata"

	BIOS_UEFI = "UEFI"
)

Variables

This section is empty.

Functions

func GenerateStartOptions

func GenerateStartOptions(
	input *GenerateStartOptionsInput,
) (string, error)

func GetDiskAddr

func GetDiskAddr(idx int, isVdiSpice bool) int

func GetDiskDeviceModel

func GetDiskDeviceModel(driver string) string

func GetNicAddr

func GetNicAddr(index int, disksLen int, isoDevsLen int, isVdiSpice bool) int

func GetNicDeviceModel

func GetNicDeviceModel(name string) string

func RegisterCmd

func RegisterCmd(cmds ...QemuCommand)

Types

type Arch

type Arch string
const (
	Arch_x86_64  Arch = "x86_64"
	Arch_aarch64 Arch = "aarch64"
)

type CPUOption

type CPUOption struct {
	EnableKVM          bool
	IsKVMSupport       bool
	HostCPUPassthrough bool
	IsCPUIntel         bool
	IsCPUAMD           bool
	EnableNested       bool
	IsolatedDeviceCPU  string
}

type GenerateStartOptionsInput

type GenerateStartOptionsInput struct {
	QemuVersion Version
	QemuArch    Arch

	CPUOption

	EnableUUID            bool
	UUID                  string
	Mem                   uint64
	Cpu                   uint
	Name                  string
	OsName                string
	HugepagesEnabled      bool
	EnableMemfd           bool
	IsQ35                 bool
	BootOrder             string
	CdromPath             string
	Nics                  []jsonutils.JSONObject
	OVNIntegrationBridge  string
	Disks                 []api.GuestdiskJsonDesc
	Devices               []string
	Machine               string
	BIOS                  string
	OVMFPath              string
	VNCPort               uint
	VNCPassword           bool
	IsolatedDevicesParams *isolated_device.QemuParams
	EnableLog             bool
	LogPath               string
	HMPMonitor            *Monitor
	QMPMonitor            *Monitor
	IsVdiSpice            bool
	SpicePort             uint
	PCIBus                string
	VGA                   string
	PidFilePath           string
	HomeDir               string
	ExtraOptions          []string
	EnableRNGRandom       bool
	EnableSerialDevice    bool
	NeedMigrate           bool
	LiveMigratePort       uint
	LiveMigrateUseTLS     bool
	IsSlave               bool
	IsMaster              bool
	EnablePvpanic         bool

	EncryptKeyPath string
}

type Monitor

type Monitor struct {
	Id   string
	Port uint
	Mode string
}

type QemuCommand

type QemuCommand interface {
	GetVersion() Version
	GetArch() Arch
	GetOptions() QemuOptions
}

func EnsureGetCommand

func EnsureGetCommand(version Version, arch Arch) QemuCommand

func GetCommand

func GetCommand(version Version, arch Arch) (QemuCommand, bool)

type QemuOptions

type QemuOptions interface {
	IsArm() bool
	CPU(opt CPUOption, osName string) (string, string, error)
	Log(enable bool, qemuLogPath string) string
	RTC() string
	FreezeCPU() string
	Daemonize() string
	Nodefaults() string
	Nodefconfig() string
	NoKVMPitReinjection() string
	Global() string
	Machine(machineType string, accel string) string
	KeyboardLayoutLanguage(lang string) string
	SMP(cpus uint) string
	Name(name string) string
	UUID(enable bool, uuid string) string
	Memory(sizeMB uint64) string
	MemPath(sizeMB uint64, p string) string
	MemDev(sizeMB uint64) string
	MemFd(sizeMB uint64) string
	Boot(order string, enableMenu bool) string
	BIOS(ovmfPath, homedir string) (string, error)
	Device(devStr string) string
	Drive(driveStr string) string
	Spice(port uint, password string) string
	Chardev(backend string, id string, name string) string
	MonitorChardev(id string, port uint, host string) string
	Mon(chardev string, id string, mode string) string
	Object(typeName string, props map[string]string) string
	Pidfile(file string) string
	USB() string
	VdiSpice(spicePort uint, pciBus string) []string
	VNC(port uint, usePasswd bool) string
	VGA(vType string, alterOpt string) string
	Cdrom(cdromPath string, osName string, isQ35 bool, disksLen int) []string
	SerialDevice() []string
	QGA(homeDir string) []string
	PvpanicDevice() string
}

type Version

type Version string
const (
	Version_4_2_0  Version = "4.2.0"
	Version_4_0_1  Version = "4.0.1"
	Version_2_12_1 Version = "2.12.1"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL