kvmrun

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIRST_INCOMING_PORT = 30000
	FIRST_WS_PORT       = 10700
	FIRST_NBD_PORT      = 60000

	CONFDIR = "/etc/kvmrun"

	VMNETINIT = "/usr/lib/kvmrun/netinit"

	QMPMONDIR  = "/var/run/kvm-monitor"
	CHROOTDIR  = "/var/lib/kvmrun/chroot"
	KERNELSDIR = "/var/lib/kvmrun/kernels"
	MODULESDIR = "/var/lib/kvmrun/modules"
	LOGDIR     = "/var/log/kvmrun"

	CGROOTPATH = "kvmrun"
)

Variables

View Source
var (
	ErrNotImplemented = errors.New("not implemented")
	ErrTimedOut       = errors.New("timeout error")
)
View Source
var CdromDrivers = DevDrivers{
	DevDriver{"scsi-cd", true},
	DevDriver{"ide-cd", false},
}
View Source
var DiskDrivers = DevDrivers{
	DevDriver{"virtio-blk-pci", true},
	DevDriver{"scsi-hd", true},
	DevDriver{"ide-hd", false},
}
View Source
var ErrIncorrectContextID = errors.New("incorrect context ID (allowed range is from 3 to 0xffffffff - 1)")
View Source
var NetDrivers = DevDrivers{
	DevDriver{"virtio-net-pci", true},
	DevDriver{"rtl8139", false},
	DevDriver{"e1000", false},
}
View Source
var Version = KvmrunVersion{1, 2, 1}

Functions

func AddTapInterface

func AddTapInterface(ifname string, uid int) error

AddTapInterface creates a new tap interface with Name == ifname and owner == uid.

func DelTapInterface

func DelTapInterface(ifname string) error

DelTapInterface destroys an existing tap interface with Name == ifname.

func GenHwAddr

func GenHwAddr() (string, error)

GenHwAddr generates a random hardware address with Linux KVM prefix 54:52:00.

func GetCommandLine

func GetCommandLine(vmi Instance, features *CommandLineFeatures) ([]string, error)

func IsAlreadyConnectedError

func IsAlreadyConnectedError(err error) bool

func IsNotConnectedError

func IsNotConnectedError(err error) bool

func IsNotRunningError

func IsNotRunningError(err error) bool

func NewCdromBackend

func NewCdromBackend(p string) (backend.DiskBackend, error)

func NewDiskBackend

func NewDiskBackend(p string) (backend.DiskBackend, error)

func ParseSCSIAddr

func ParseSCSIAddr(s string) (string, string, string)

func SetInterfaceUp

func SetInterfaceUp(ifname string) error

SetInterfaceUp changes the state of a given interface to UP.

Types

type AlreadyConnectedError

type AlreadyConnectedError struct {
	Source string
	Object string
}

func (*AlreadyConnectedError) Error

func (e *AlreadyConnectedError) Error() string

type CDPool

type CDPool []Cdrom

func (*CDPool) Append

func (p *CDPool) Append(d *Cdrom)

Append appends a new element to the end of the list.

func (CDPool) Exists

func (p CDPool) Exists(name string) bool

Exists returns true if an element with Path == p is present in the list. Otherwise returns false.

func (CDPool) Get

func (p CDPool) Get(name string) *Cdrom

Get returns a pointer to an element with Path == p.

func (*CDPool) Insert

func (p *CDPool) Insert(d *Cdrom, idx int) error

Insert inserts a new element into the list at a given position.

func (*CDPool) Remove

func (p *CDPool) Remove(name string) error

Remove removes an element with Ifname == ifname from the list.

func (*CDPool) RemoveN

func (p *CDPool) RemoveN(idx int) error

RemoveN removes an element with Index == idx from the list.

type Cdrom

type Cdrom struct {
	Name      string `json:"name"`
	Media     string `json:"media"`
	Driver    string `json:"driver"`
	Addr      string `json:"addr,omitempty"`
	Bootindex uint   `json:"bootindex,omitempty"`
	ReadOnly  bool   `json:"readonly,omitempty"`

	Backend backend.DiskBackend `json:"-"`
}

func NewCdrom

func NewCdrom(name, media string) (*Cdrom, error)

func (Cdrom) IsLocal

func (d Cdrom) IsLocal() bool

func (Cdrom) QdevID

func (d Cdrom) QdevID() string

type CloudInitDrive

type CloudInitDrive struct {
	Path string `json:"path,omitempty"`
}

CloudInitDrive contains a path to the cloud-init drive.

type CommandLineFeatures

type CommandLineFeatures struct {
	NoReboot     bool
	IncomingHost string
	VNCHost      string
}

type DevDriver

type DevDriver struct {
	Name         string `json:"name"`
	HotPluggable bool   `json:"hotplugguble"`
}

type DevDrivers

type DevDrivers []DevDriver

func (DevDrivers) Exists

func (d DevDrivers) Exists(name string) bool

func (DevDrivers) HotPluggable

func (d DevDrivers) HotPluggable(name string) bool

type Disk

type Disk struct {
	Backend         backend.DiskBackend `json:"-"`
	Path            string              `json:"path"`
	Driver          string              `json:"driver"`
	IopsRd          int                 `json:"iops_rd"`
	IopsWr          int                 `json:"iops_wr"`
	Addr            string              `json:"addr,omitempty"`
	Bootindex       uint                `json:"bootindex,omitempty"`
	QemuVirtualSize uint64              `json:"-"`
	HasBitmap       bool                `json:"-"`
}

func NewDisk

func NewDisk(p string) (*Disk, error)

func (Disk) BaseName

func (d Disk) BaseName() string

func (Disk) IsAvailable

func (d Disk) IsAvailable() (bool, error)

func (Disk) IsLocal

func (d Disk) IsLocal() bool

func (Disk) QdevID

func (d Disk) QdevID() string

type DiskPool

type DiskPool []Disk

func (*DiskPool) Append

func (p *DiskPool) Append(d *Disk)

Append appends a new element to the end of the list.

func (DiskPool) Exists

func (p DiskPool) Exists(dpath string) bool

Exists returns true if an element with Path == p is present in the list. Otherwise returns false.

func (DiskPool) Get

func (p DiskPool) Get(dpath string) *Disk

Get returns a pointer to an element with Path == p.

func (*DiskPool) Insert

func (p *DiskPool) Insert(d *Disk, idx int) error

Insert inserts a new element into the list at a given position.

func (*DiskPool) Remove

func (p *DiskPool) Remove(dpath string) error

Remove removes an element with Ifname == ifname from the list.

func (*DiskPool) RemoveN

func (p *DiskPool) RemoveN(idx int) error

RemoveN removes an element with Index == idx from the list.

type ExtKernel

type ExtKernel struct {
	Image   string `json:"image,omitempty"`
	Cmdline string `json:"cmdline,omitempty"`
	Initrd  string `json:"initrd,omitempty"`
	Modiso  string `json:"modiso,omitempty"`
}

ExtKernel represents the guest kernel configuration structure.

type IncomingConf

type IncomingConf struct {
	InstanceConf
}

IncomingConf represents a virtual machine configuration that is used to launch a QEMU incoming instance.

type InputDevice

type InputDevice struct {
	Type string `json:"type"`
}

type InputPool

type InputPool []InputDevice

func (*InputPool) Append

func (p *InputPool) Append(d *InputDevice)

Append appends a new element to the end of the list.

func (InputPool) Exists

func (p InputPool) Exists(t string) bool

Exists returns true if an element with Type == t is present in the list. Otherwise returns false.

func (InputPool) Get

func (p InputPool) Get(t string) *InputDevice

Get returns a pointer to an element with Type == t.

func (*InputPool) Remove

func (p *InputPool) Remove(t string) error

Remove removes an element with Type == t from the list.

func (*InputPool) RemoveN

func (p *InputPool) RemoveN(idx int) error

RemoveN removes an element with Index == idx from the list.

type Instance

type Instance interface {
	Name() string
	Uid() int
	Pid() int

	Status() (InstanceState, error)
	GetMachineType() *QemuMachine
	SetMachineType(string) error
	GetFirmwareImage() string
	SetFirmwareImage(string) error
	RemoveFirmwareConf() error
	IsIncoming() bool

	Save() error

	GetActualMem() int
	GetTotalMem() int
	SetTotalMem(int) error
	SetActualMem(int) error

	GetActualCPUs() int
	GetTotalCPUs() int
	GetCPUSockets() int
	GetCPUQuota() int
	GetCPUModel() string
	SetActualCPUs(int) error
	SetTotalCPUs(int) error
	SetCPUSockets(int) error
	SetCPUQuota(int) error
	SetCPUModel(string) error

	GetInputDevices() InputPool
	AppendInputDevice(InputDevice) error
	RemoveInputDevice(string) error

	GetCdroms() CDPool
	AppendCdrom(Cdrom) error
	InsertCdrom(Cdrom, int) error
	RemoveCdrom(string) error
	GetCdromMedia(string) (string, error)
	ChangeCdromMedia(string, string) error

	GetDisks() DiskPool
	ResizeQemuBlockdev(string) error
	AppendDisk(Disk) error
	InsertDisk(Disk, int) error
	RemoveDisk(string) error
	SetDiskReadIops(string, int) error
	SetDiskWriteIops(string, int) error
	RemoveDiskBitmap(string) error

	GetProxyServers() ProxyPool
	AppendProxy(Proxy) error
	RemoveProxy(string) error

	GetNetIfaces() NetifPool
	AppendNetIface(NetIface) error
	RemoveNetIface(string) error
	SetNetIfaceUpScript(string, string) error
	SetNetIfaceDownScript(string, string) error
	SetNetIfaceLinkUp(string) error
	SetNetIfaceLinkDown(string) error

	GetVSockDevice() *VirtioVSock
	AppendVSockDevice(uint32) error
	RemoveVSockDevice() error

	GetCloudInitDrive() string
	SetCloudInitDrive(string) error

	GetKernelImage() string
	GetKernelCmdline() string
	GetKernelInitrd() string
	GetKernelModiso() string
	RemoveKernelConf() error
	SetKernelImage(string) error
	SetKernelCmdline(string) error
	SetKernelInitrd(string) error
	SetKernelModiso(string) error

	SetVNCPassword(string) error
}

func GetIncomingConf

func GetIncomingConf(vmname string) (Instance, error)

func GetInstanceConf

func GetInstanceConf(vmname string) (Instance, error)

func GetInstanceQemu

func GetInstanceQemu(vmname string, mon *qmp.Monitor) (Instance, error)

func GetStartupConf

func GetStartupConf(vmname string) (Instance, error)

func NewIncomingConf

func NewIncomingConf(vmname string) Instance

func NewInstanceConf

func NewInstanceConf(vmname string) Instance

type InstanceConf

type InstanceConf struct {
	*InstanceProperties
	// contains filtered or unexported fields
}

InstanceConf represents a virtual machine configuration that is used to prepare a QEMU command line.

func (*InstanceConf) AppendCdrom

func (c *InstanceConf) AppendCdrom(d Cdrom) error

func (*InstanceConf) AppendDisk

func (c *InstanceConf) AppendDisk(d Disk) error

func (*InstanceConf) AppendInputDevice

func (c *InstanceConf) AppendInputDevice(d InputDevice) error

func (*InstanceConf) AppendNetIface

func (c *InstanceConf) AppendNetIface(iface NetIface) error

func (*InstanceConf) AppendProxy

func (c *InstanceConf) AppendProxy(proxy Proxy) error

func (*InstanceConf) AppendVSockDevice

func (c *InstanceConf) AppendVSockDevice(cid uint32) error

func (*InstanceConf) ChangeCdromMedia

func (c *InstanceConf) ChangeCdromMedia(name, media string) error

func (*InstanceConf) InsertCdrom

func (c *InstanceConf) InsertCdrom(d Cdrom, idx int) error

func (*InstanceConf) InsertDisk

func (c *InstanceConf) InsertDisk(d Disk, idx int) error

func (InstanceConf) IsIncoming

func (c InstanceConf) IsIncoming() bool

func (InstanceConf) Pid

func (c InstanceConf) Pid() int

func (*InstanceConf) RemoveCdrom

func (c *InstanceConf) RemoveCdrom(name string) error

func (*InstanceConf) RemoveDisk

func (c *InstanceConf) RemoveDisk(dpath string) error

func (InstanceConf) RemoveDiskBitmap

func (c InstanceConf) RemoveDiskBitmap(dpath string) error

func (*InstanceConf) RemoveFirmwareConf added in v1.1.0

func (c *InstanceConf) RemoveFirmwareConf() error

func (*InstanceConf) RemoveInputDevice

func (c *InstanceConf) RemoveInputDevice(t string) error

func (*InstanceConf) RemoveKernelConf

func (c *InstanceConf) RemoveKernelConf() error

func (*InstanceConf) RemoveNetIface

func (c *InstanceConf) RemoveNetIface(ifname string) error

func (*InstanceConf) RemoveProxy

func (c *InstanceConf) RemoveProxy(fullpath string) error

func (*InstanceConf) RemoveVSockDevice

func (c *InstanceConf) RemoveVSockDevice() error

func (InstanceConf) ResizeQemuBlockdev

func (c InstanceConf) ResizeQemuBlockdev(_ string) error

func (InstanceConf) Save

func (c InstanceConf) Save() error

func (InstanceConf) SaveStartupConfig

func (c InstanceConf) SaveStartupConfig() error

func (*InstanceConf) SetActualCPUs

func (c *InstanceConf) SetActualCPUs(n int) error

func (*InstanceConf) SetActualMem

func (c *InstanceConf) SetActualMem(s int) error

func (*InstanceConf) SetCPUModel

func (c *InstanceConf) SetCPUModel(model string) error

func (*InstanceConf) SetCPUQuota

func (c *InstanceConf) SetCPUQuota(quota int) error

func (*InstanceConf) SetCPUSockets

func (c *InstanceConf) SetCPUSockets(n int) error

func (*InstanceConf) SetCloudInitDrive

func (c *InstanceConf) SetCloudInitDrive(s string) error

func (*InstanceConf) SetDiskReadIops

func (c *InstanceConf) SetDiskReadIops(dpath string, iops int) error

func (*InstanceConf) SetDiskWriteIops

func (c *InstanceConf) SetDiskWriteIops(dpath string, iops int) error

func (*InstanceConf) SetFirmwareImage added in v1.1.0

func (c *InstanceConf) SetFirmwareImage(p string) error

func (*InstanceConf) SetKernelCmdline

func (c *InstanceConf) SetKernelCmdline(s string) error

func (*InstanceConf) SetKernelImage

func (c *InstanceConf) SetKernelImage(s string) error

func (*InstanceConf) SetKernelInitrd

func (c *InstanceConf) SetKernelInitrd(s string) error

func (*InstanceConf) SetKernelModiso

func (c *InstanceConf) SetKernelModiso(s string) error

func (*InstanceConf) SetMachineType

func (c *InstanceConf) SetMachineType(t string) error

func (*InstanceConf) SetNetIfaceDownScript

func (c *InstanceConf) SetNetIfaceDownScript(ifname, scriptPath string) error

func (*InstanceConf) SetNetIfaceLinkDown

func (c *InstanceConf) SetNetIfaceLinkDown(ifname string) error

func (*InstanceConf) SetNetIfaceLinkUp

func (c *InstanceConf) SetNetIfaceLinkUp(ifname string) error

func (*InstanceConf) SetNetIfaceUpScript

func (c *InstanceConf) SetNetIfaceUpScript(ifname, scriptPath string) error

func (*InstanceConf) SetTotalCPUs

func (c *InstanceConf) SetTotalCPUs(n int) error

func (*InstanceConf) SetTotalMem

func (c *InstanceConf) SetTotalMem(s int) error

func (InstanceConf) SetVNCPassword

func (c InstanceConf) SetVNCPassword(s string) error

func (InstanceConf) Status

func (c InstanceConf) Status() (InstanceState, error)

type InstanceProperties

type InstanceProperties struct {
	MachineType string       `json:"machine_type,omitempty"`
	Firmware    QemuFirmware `json:"firmware,omitempty"`

	Mem         Memory         `json:"memory"`
	CPU         Processor      `json:"cpu"`
	Inputs      InputPool      `json:"inputs"`
	Cdroms      CDPool         `json:"cdrom"`
	Disks       DiskPool       `json:"storage"`
	Proxy       ProxyPool      `json:"proxy,omitempty"`
	NetIfaces   NetifPool      `json:"network"`
	VSockDevice *VirtioVSock   `json:"vsock_device,omitempty"`
	CIDrive     CloudInitDrive `json:"cloudinit_drive,omitempty"`
	Kernel      ExtKernel      `json:"kernel"`
	// contains filtered or unexported fields
}

func (InstanceProperties) GetActualCPUs

func (p InstanceProperties) GetActualCPUs() int

func (InstanceProperties) GetActualMem

func (p InstanceProperties) GetActualMem() int

func (InstanceProperties) GetCPUModel

func (p InstanceProperties) GetCPUModel() string

func (InstanceProperties) GetCPUQuota

func (p InstanceProperties) GetCPUQuota() int

func (InstanceProperties) GetCPUSockets

func (p InstanceProperties) GetCPUSockets() int

func (InstanceProperties) GetCdromMedia

func (p InstanceProperties) GetCdromMedia(name string) (string, error)

func (InstanceProperties) GetCdroms

func (p InstanceProperties) GetCdroms() CDPool

func (InstanceProperties) GetCloudInitDrive

func (p InstanceProperties) GetCloudInitDrive() string

func (InstanceProperties) GetDisks

func (p InstanceProperties) GetDisks() DiskPool

func (InstanceProperties) GetFirmwareImage added in v1.1.0

func (p InstanceProperties) GetFirmwareImage() string

func (InstanceProperties) GetInputDevices

func (p InstanceProperties) GetInputDevices() InputPool

func (InstanceProperties) GetKernelCmdline

func (p InstanceProperties) GetKernelCmdline() string

func (InstanceProperties) GetKernelImage

func (p InstanceProperties) GetKernelImage() string

func (InstanceProperties) GetKernelInitrd

func (p InstanceProperties) GetKernelInitrd() string

func (InstanceProperties) GetKernelModiso

func (p InstanceProperties) GetKernelModiso() string

func (InstanceProperties) GetMachineType

func (p InstanceProperties) GetMachineType() *QemuMachine

func (InstanceProperties) GetNetIfaces

func (p InstanceProperties) GetNetIfaces() NetifPool

func (InstanceProperties) GetProxyServers

func (p InstanceProperties) GetProxyServers() ProxyPool

func (InstanceProperties) GetTotalCPUs

func (p InstanceProperties) GetTotalCPUs() int

func (InstanceProperties) GetTotalMem

func (p InstanceProperties) GetTotalMem() int

func (InstanceProperties) GetVSockDevice

func (p InstanceProperties) GetVSockDevice() *VirtioVSock

func (InstanceProperties) Name

func (p InstanceProperties) Name() string

func (InstanceProperties) Uid

func (p InstanceProperties) Uid() int

type InstanceQemu

type InstanceQemu struct {
	*InstanceProperties
	// contains filtered or unexported fields
}

InstanceQemu represents a configuration of a running QEMU instance.

func (*InstanceQemu) AppendCdrom

func (r *InstanceQemu) AppendCdrom(_ Cdrom) error

func (*InstanceQemu) AppendDisk

func (r *InstanceQemu) AppendDisk(_ Disk) error

func (*InstanceQemu) AppendInputDevice

func (r *InstanceQemu) AppendInputDevice(_ InputDevice) error

func (*InstanceQemu) AppendNetIface

func (r *InstanceQemu) AppendNetIface(_ NetIface) error

func (*InstanceQemu) AppendProxy

func (r *InstanceQemu) AppendProxy(proxy Proxy) error

func (*InstanceQemu) AppendVSockDevice

func (r *InstanceQemu) AppendVSockDevice(cid uint32) error

func (*InstanceQemu) ChangeCdromMedia

func (r *InstanceQemu) ChangeCdromMedia(name, media string) error

func (*InstanceQemu) InsertCdrom

func (r *InstanceQemu) InsertCdrom(_ Cdrom, _ int) error

func (*InstanceQemu) InsertDisk

func (r *InstanceQemu) InsertDisk(_ Disk, _ int) error

func (InstanceQemu) IsIncoming

func (r InstanceQemu) IsIncoming() bool

func (InstanceQemu) Pid

func (r InstanceQemu) Pid() int

func (*InstanceQemu) RemoveCdrom

func (r *InstanceQemu) RemoveCdrom(_ string) error

func (*InstanceQemu) RemoveDisk

func (r *InstanceQemu) RemoveDisk(_ string) error

func (*InstanceQemu) RemoveDiskBitmap

func (r *InstanceQemu) RemoveDiskBitmap(dpath string) error

func (*InstanceQemu) RemoveFirmwareConf added in v1.1.0

func (r *InstanceQemu) RemoveFirmwareConf() error

func (*InstanceQemu) RemoveInputDevice

func (r *InstanceQemu) RemoveInputDevice(_ string) error

func (*InstanceQemu) RemoveKernelConf

func (r *InstanceQemu) RemoveKernelConf() error

func (*InstanceQemu) RemoveNetIface

func (r *InstanceQemu) RemoveNetIface(_ string) error

func (*InstanceQemu) RemoveProxy

func (r *InstanceQemu) RemoveProxy(fullpath string) error

func (*InstanceQemu) RemoveVSockDevice

func (r *InstanceQemu) RemoveVSockDevice() error

func (InstanceQemu) ResizeQemuBlockdev

func (r InstanceQemu) ResizeQemuBlockdev(dpath string) error

func (InstanceQemu) Save

func (r InstanceQemu) Save() error

func (*InstanceQemu) SetActualCPUs

func (r *InstanceQemu) SetActualCPUs(n int) error

func (*InstanceQemu) SetActualMem

func (r *InstanceQemu) SetActualMem(s int) error

func (*InstanceQemu) SetCPUModel

func (r *InstanceQemu) SetCPUModel(model string) error

func (*InstanceQemu) SetCPUQuota

func (r *InstanceQemu) SetCPUQuota(quota int) error

func (*InstanceQemu) SetCPUSockets

func (r *InstanceQemu) SetCPUSockets(n int) error

func (*InstanceQemu) SetCloudInitDrive

func (r *InstanceQemu) SetCloudInitDrive(s string) error

func (*InstanceQemu) SetDiskReadIops

func (r *InstanceQemu) SetDiskReadIops(dpath string, iops int) error

func (*InstanceQemu) SetDiskWriteIops

func (r *InstanceQemu) SetDiskWriteIops(dpath string, iops int) error

func (InstanceQemu) SetFirmwareImage added in v1.1.0

func (r InstanceQemu) SetFirmwareImage(_ string) error

func (*InstanceQemu) SetKernelCmdline

func (r *InstanceQemu) SetKernelCmdline(s string) error

func (*InstanceQemu) SetKernelImage

func (r *InstanceQemu) SetKernelImage(s string) error

func (*InstanceQemu) SetKernelInitrd

func (r *InstanceQemu) SetKernelInitrd(s string) error

func (*InstanceQemu) SetKernelModiso

func (r *InstanceQemu) SetKernelModiso(s string) error

func (InstanceQemu) SetMachineType

func (r InstanceQemu) SetMachineType(_ string) error

func (*InstanceQemu) SetNetIfaceDownScript

func (r *InstanceQemu) SetNetIfaceDownScript(_, _ string) error

func (*InstanceQemu) SetNetIfaceLinkDown

func (r *InstanceQemu) SetNetIfaceLinkDown(ifname string) error

func (*InstanceQemu) SetNetIfaceLinkUp

func (r *InstanceQemu) SetNetIfaceLinkUp(ifname string) error

func (*InstanceQemu) SetNetIfaceUpScript

func (r *InstanceQemu) SetNetIfaceUpScript(_, _ string) error

func (*InstanceQemu) SetTotalCPUs

func (r *InstanceQemu) SetTotalCPUs(n int) error

func (*InstanceQemu) SetTotalMem

func (r *InstanceQemu) SetTotalMem(_ int) error

func (InstanceQemu) SetVNCPassword

func (r InstanceQemu) SetVNCPassword(s string) error

func (InstanceQemu) Status

func (r InstanceQemu) Status() (InstanceState, error)

type InstanceQemu_i440fx

type InstanceQemu_i440fx struct {
	*InstanceQemu
}

InstanceQemu represents a configuration of a running QEMU instance.

func (*InstanceQemu_i440fx) AppendCdrom

func (r *InstanceQemu_i440fx) AppendCdrom(d Cdrom) error

func (*InstanceQemu_i440fx) AppendDisk

func (r *InstanceQemu_i440fx) AppendDisk(d Disk) error

func (*InstanceQemu_i440fx) AppendNetIface

func (r *InstanceQemu_i440fx) AppendNetIface(iface NetIface) error

func (*InstanceQemu_i440fx) RemoveCdrom

func (r *InstanceQemu_i440fx) RemoveCdrom(name string) error

func (*InstanceQemu_i440fx) RemoveDisk

func (r *InstanceQemu_i440fx) RemoveDisk(dpath string) error

func (*InstanceQemu_i440fx) RemoveNetIface

func (r *InstanceQemu_i440fx) RemoveNetIface(ifname string) error

type InstanceState

type InstanceState uint16
const (
	StateNoState InstanceState = iota
	StateStarting
	StateRunning
	StatePaused
	StateShutdown
	StateInactive
	StateCrashed
	StateIncoming
	StateMigrating
	StateMigrated
)

type KvmrunVersion

type KvmrunVersion struct {
	Major int `json:"major"`
	Minor int `json:"minor"`
	Micro int `json:"micro"`
}

func (KvmrunVersion) String

func (v KvmrunVersion) String() string

func (KvmrunVersion) ToInt

func (v KvmrunVersion) ToInt() int

type Machine

type Machine struct {
	Name string   `json:"name"`
	C    Instance `json:"conf"`
	R    Instance `json:"run,omitempty"`
}

func GetMachine

func GetMachine(vmname string, mon *qmp.Monitor) (*Machine, error)

type Memory

type Memory struct {
	Actual int `json:"actual"`
	Total  int `json:"total"`
}

Memory represents the guest memory configuration structure.

type NetIface

type NetIface struct {
	Ifname    string `json:"ifname"`
	Driver    string `json:"driver"`
	HwAddr    string `json:"hwaddr"`
	Addr      string `json:"addr,omitempty"`
	Bootindex int    `json:"bootindex,omitempty"`
	Ifup      string `json:"ifup,omitempty"`
	Ifdown    string `json:"ifdown,omitempty"`
}

func (*NetIface) QdevID

func (iface *NetIface) QdevID() string

type NetifPool

type NetifPool []NetIface

func (*NetifPool) Append

func (p *NetifPool) Append(iface *NetIface)

Append appends a new element to the end of the list.

func (NetifPool) Exists

func (p NetifPool) Exists(ifname string) bool

Exists returns true if an element with Ifname == ifname is present in the list. Otherwise returns false.

func (NetifPool) Get

func (p NetifPool) Get(ifname string) *NetIface

Get returns a pointer to an element with Ifname == ifname.

func (*NetifPool) Insert

func (p *NetifPool) Insert(iface *NetIface, idx int) error

Insert inserts a new element into the list at a given position.

func (*NetifPool) Remove

func (p *NetifPool) Remove(ifname string) error

Remove removes an element with Ifname == ifname from the list.

func (*NetifPool) RemoveN

func (p *NetifPool) RemoveN(idx int) error

RemoveN removes an element with Index == idx from the list.

type NotConnectedError

type NotConnectedError struct {
	Source string
	Object string
}

func (*NotConnectedError) Error

func (e *NotConnectedError) Error() string

type NotFoundError

type NotFoundError struct {
	Name string
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type NotRunningError

type NotRunningError struct {
	Name string
}

func (*NotRunningError) Error

func (e *NotRunningError) Error() string

type Processor

type Processor struct {
	Actual  int    `json:"actual"`
	Total   int    `json:"total"`
	Sockets int    `json:"sockets,omitempty"`
	Quota   int    `json:"quota,omitempty"`
	Model   string `json:"model,omitempty"`
}

Processor represents the guest virtual CPU configuration structure.

type Proxy

type Proxy struct {
	Path    string            `json:"path"`
	Command string            `json:"command"`
	Envs    map[string]string `json:"envs"`
}

type ProxyPool

type ProxyPool []Proxy

func (*ProxyPool) Append

func (p *ProxyPool) Append(proxy *Proxy)

Append appends a new element to the end of the list.

func (ProxyPool) Exists

func (p ProxyPool) Exists(fullpath string) bool

Exists returns true if an element with Path == fullpath is present in the list. Otherwise returns false.

func (ProxyPool) Get

func (p ProxyPool) Get(fullpath string) *Proxy

Get returns a pointer to an element with Path == fullpath.

func (*ProxyPool) Insert

func (p *ProxyPool) Insert(proxy *Proxy, idx int) error

Insert inserts a new element into the list at a given position.

func (*ProxyPool) Remove

func (p *ProxyPool) Remove(fullpath string) error

Remove removes an element with Path == fullpath from the list.

func (*ProxyPool) RemoveN

func (p *ProxyPool) RemoveN(idx int) error

RemoveN removes an element with Index == idx from the list.

type QemuChipset

type QemuChipset int32
const (
	QEMU_CHIPSET_UNKNOWN QemuChipset = iota
	QEMU_CHIPSET_I440FX
	QEMU_CHIPSET_Q35
	QEMU_CHIPSET_MICROVM
)

type QemuFirmware added in v1.1.0

type QemuFirmware struct {
	Image string `json:"image,omitempty"`
}

type QemuMachine

type QemuMachine struct {
	Chipset QemuChipset `json:"type"`
	// contains filtered or unexported fields
}

func (*QemuMachine) String

func (m *QemuMachine) String() string

type QemuVersion

type QemuVersion int

func (QemuVersion) String

func (v QemuVersion) String() string

type SCSIBusInfo

type SCSIBusInfo struct {
	Type string `json:"type"`
	Addr string `json:"addr,omitempty"`
}

type StartupConf

type StartupConf struct {
	InstanceConf
}

StartupConf represents a virtual machine configuration that was used to launch a QEMU instance.

func (StartupConf) Save

func (c StartupConf) Save() error

type VirtioVSock

type VirtioVSock struct {
	Auto      bool   `json:"auto,omitempty"`
	ContextID uint32 `json:"context_id,omitempty"`
	Addr      string `json:"addr,omitempty"`
}

Directories

Path Synopsis
nbd

Jump to

Keyboard shortcuts

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