kvmrun

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 31 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 CloudInitDrivers = DevDrivers{
	DevDriver{"ide-cd", false},
	DevDriver{"floppy", 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, 4, 2}

Functions

func AddTapInterface

func AddTapInterface(ifname string, uid int, mq bool) 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 NewCloudInitDriveBackend added in v1.4.1

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

func NewDiskBackend

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

func NewFirmwareBackend added in v1.3.1

func NewFirmwareBackend(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 {
	Media  string `json:"path,omitempty"`
	Driver string `json:"driver,omitempty"`

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

CloudInitDrive contains a path to the cloud-init drive.

func NewCloudInitDrive added in v1.4.1

func NewCloudInitDrive(media string) (*CloudInitDrive, error)

func (*CloudInitDrive) IsLocal added in v1.4.1

func (d *CloudInitDrive) IsLocal() bool

func (*CloudInitDrive) QdevID added in v1.4.1

func (d *CloudInitDrive) QdevID() string

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 FirmwareBackend added in v1.3.1

type FirmwareBackend struct {
	backend.DiskBackend
}

func (*FirmwareBackend) BaseName added in v1.3.1

func (b *FirmwareBackend) BaseName() string

func (*FirmwareBackend) QdevID added in v1.3.1

func (b *FirmwareBackend) QdevID() string

type HostPCI added in v1.3.1

type HostPCI struct {
	Addr          string `json:"addr"` // in format [domain:]bus:device.function
	PrimaryGPU    bool   `json:"primary_gpu"`
	Multifunction bool   `json:"multifunction"`

	BackendAddr *pci.Address `json:"-"`
}

func NewHostPCI added in v1.3.1

func NewHostPCI(hexaddr string) (*HostPCI, error)

type HostPCIPool added in v1.3.1

type HostPCIPool []HostPCI

func (*HostPCIPool) Append added in v1.3.1

func (p *HostPCIPool) Append(d *HostPCI)

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

func (HostPCIPool) Exists added in v1.3.1

func (p HostPCIPool) Exists(hexaddr string) bool

Exists returns true if an element with requested address is present in the list. Otherwise returns false.

func (HostPCIPool) Get added in v1.3.1

func (p HostPCIPool) Get(hexaddr string) *HostPCI

Get returns a pointer to an element with requested address.

func (*HostPCIPool) Remove added in v1.3.1

func (p *HostPCIPool) Remove(hexaddr string) error

Remove removes an element with requested address from the list.

func (*HostPCIPool) RemoveN added in v1.3.1

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

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

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

	GetQemuVersion() QemuVersion

	Status() (InstanceState, error)
	GetMachineType() *QemuMachine
	SetMachineType(string) error

	IsIncoming() bool

	GetFirmwareImage() string
	GetFirmwareFlash() *Disk
	SetFirmwareImage(string) error
	SetFirmwareFlash(string) error
	RemoveFirmwareConf() error

	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

	GetHostPCIDevices() HostPCIPool
	AppendHostPCI(HostPCI) error
	RemoveHostPCI(string) error
	SetHostPCIMultifunctionOption(string, bool) error
	SetHostPCIPrimaryGPUOption(string, bool) 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
	SetNetIfaceQueues(string, int) error
	SetNetIfaceUpScript(string, string) error
	SetNetIfaceDownScript(string, string) error
	SetNetIfaceLinkUp(string) error
	SetNetIfaceLinkDown(string) error

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

	GetCloudInitDrive() *CloudInitDrive
	SetCloudInitMedia(string) error
	SetCloudInitDriver(string) error
	RemoveCloudInitConf() 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) AppendHostPCI added in v1.3.1

func (c *InstanceConf) AppendHostPCI(d HostPCI) 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) RemoveCloudInitConf added in v1.4.1

func (c *InstanceConf) RemoveCloudInitConf() 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) RemoveHostPCI added in v1.3.1

func (c *InstanceConf) RemoveHostPCI(hexaddr string) 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) SetCloudInitDriver added in v1.4.1

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

func (*InstanceConf) SetCloudInitMedia added in v1.4.1

func (c *InstanceConf) SetCloudInitMedia(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) SetFirmwareFlash added in v1.3.1

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

func (*InstanceConf) SetFirmwareImage added in v1.1.0

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

func (*InstanceConf) SetHostPCIMultifunctionOption added in v1.3.1

func (c *InstanceConf) SetHostPCIMultifunctionOption(hexaddr string, enabled bool) error

func (*InstanceConf) SetHostPCIPrimaryGPUOption added in v1.3.1

func (c *InstanceConf) SetHostPCIPrimaryGPUOption(hexaddr string, enabled bool) 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) SetNetIfaceQueues added in v1.3.1

func (c *InstanceConf) SetNetIfaceQueues(ifname string, queues int) 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"`
	HostPCIDevices HostPCIPool     `json:"hostpci"`
	// 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() *CloudInitDrive

func (InstanceProperties) GetDisks

func (p InstanceProperties) GetDisks() DiskPool

func (InstanceProperties) GetFirmwareFlash added in v1.3.1

func (p InstanceProperties) GetFirmwareFlash() *Disk

func (InstanceProperties) GetFirmwareImage added in v1.1.0

func (p InstanceProperties) GetFirmwareImage() string

func (InstanceProperties) GetHostPCIDevices added in v1.3.1

func (p InstanceProperties) GetHostPCIDevices() HostPCIPool

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) GetQemuVersion added in v1.3.1

func (p InstanceProperties) GetQemuVersion() QemuVersion

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) AppendHostPCI added in v1.3.1

func (r *InstanceQemu) AppendHostPCI(_ HostPCI) 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) GetQemuVersion added in v1.3.1

func (r InstanceQemu) GetQemuVersion() QemuVersion

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) RemoveCloudInitConf added in v1.4.1

func (r *InstanceQemu) RemoveCloudInitConf() 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) RemoveHostPCI added in v1.3.1

func (r *InstanceQemu) RemoveHostPCI(_ string) 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) SetCloudInitDriver added in v1.4.1

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

func (*InstanceQemu) SetCloudInitMedia added in v1.4.1

func (r *InstanceQemu) SetCloudInitMedia(media 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) SetFirmwareFlash added in v1.3.1

func (r InstanceQemu) SetFirmwareFlash(_ string) error

func (InstanceQemu) SetFirmwareImage added in v1.1.0

func (r InstanceQemu) SetFirmwareImage(_ string) error

func (*InstanceQemu) SetHostPCIMultifunctionOption added in v1.3.1

func (r *InstanceQemu) SetHostPCIMultifunctionOption(_ string, _ bool) error

func (*InstanceQemu) SetHostPCIPrimaryGPUOption added in v1.3.1

func (r *InstanceQemu) SetHostPCIPrimaryGPUOption(_ string, _ bool) 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) SetNetIfaceQueues added in v1.3.1

func (r *InstanceQemu) SetNetIfaceQueues(_ string, _ int) 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
	// contains filtered or unexported fields
}

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"`
	Queues    int    `json:"queues"`
	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"`
	Flash string `json:"flash,omitempty"`
	// contains filtered or unexported fields
}

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