qpdevices

package
v0.0.0-...-4b93689 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IDECDType  = DeviceType{"ide-cd"}
	IDEHDType  = DeviceType{"ide-hd"}
	NVMEType   = DeviceType{"nvme"}
	NVMENSType = DeviceType{"nvme-ns"}
	SCSICDType = DeviceType{"scsi-cd"}
	SCSIHDType = DeviceType{"scsi-hd"}
)
View Source
var (
	DiscardIgnore = DiscardOption{"ignore"}
	DiscardUnmap  = DiscardOption{"unmap"}
)
View Source
var VirtIOSCSIPCIType = DeviceType{"virtio-scsi-pci"}

Functions

This section is empty.

Types

type BaseDevice

type BaseDevice struct {
	Type DeviceType `qp:"~unnamed"`

	// Name specifies a unique identifier for the given device.
	Name string `qp:"name=id"`
	// contains filtered or unexported fields
}

type BlockDevice

type BlockDevice struct {
	Driver       string                ``
	Name         string                `qp:"name=node-name"`
	ReadOnly     qpoption.Option[bool] ``
	AutoReadOnly qpoption.Option[bool] ``
	ForceShare   qpoption.Option[bool] ``
	CacheDirect  qpoption.Option[bool] `qp:"name='cache.direct'"`
	CacheNoFlush qpoption.Option[bool] `qp:"name='cache.no-flush'"`
	Discard      DiscardOption         `qp:""`
	DetectZeroes qpoption.Option[bool] `qp:"~kebab"`
	// contains filtered or unexported fields
}

BlockDevice defines a new block driver node.

<https://man.archlinux.org/man/qemu.1.en#blockdev>

func (*BlockDevice) GetName

func (d *BlockDevice) GetName() string

type Boot

type Boot struct {
	Order string
	Once  string
	// contains filtered or unexported fields
}

func (Boot) GetCliArgs

func (d Boot) GetCliArgs() ([]string, error)

type BootableDevice

type BootableDevice struct {
	// BootIndex is used to determine the order in which firmware
	// will consider devices for booting the guest OS.
	BootIndex qpoption.Option[int]
}

func NewBootableDevice

func NewBootableDevice(bootIndex int) BootableDevice

type CPU

type CPU struct{ Model string }

func (CPU) GetCliArgs

func (d CPU) GetCliArgs() ([]string, error)

type CharDevice

type CharDevice struct {
	Type string                `qp:"~unnamed"`
	Name string                `qp:"name='id'"`
	Mux  qpoption.Option[bool] `qp:""`
	// contains filtered or unexported fields
}

func (CharDevice) GetName

func (d CharDevice) GetName() string

type Conduit

type Conduit struct {
	// contains filtered or unexported fields
}

Conduit is a special device that creates a unix.Socketpair which connects the right side of the pair to the virtual machine as a CharDevice and the left side with the host system as a net.Conn instance.

func NewConduit

func NewConduit(name string) (c *Conduit, err error)

func (*Conduit) Conn

func (c *Conduit) Conn() net.Conn

func (*Conduit) GetCliArgs

func (c *Conduit) GetCliArgs() ([]string, error)

func (*Conduit) GetFiles

func (c *Conduit) GetFiles() []libqatapult.File

func (*Conduit) GetName

func (c *Conduit) GetName() string

type DeviceType

type DeviceType struct {
	// contains filtered or unexported fields
}

func NewStorageDeviceType

func NewStorageDeviceType(slug string) DeviceType

func (DeviceType) String

func (t DeviceType) String() string

type DiscardOption

type DiscardOption struct {
	// contains filtered or unexported fields
}

func (DiscardOption) String

func (o DiscardOption) String() string

type FDSocketCharDevice

type FDSocketCharDevice struct {
	CharDevice
	SocketCharDevice

	FD int
}

func (FDSocketCharDevice) GetCliArgs

func (d FDSocketCharDevice) GetCliArgs() ([]string, error)

type FileBlockDevice

type FileBlockDevice struct {
	BlockDevice
	File       libqatapult.File      `qp:"name=filename"`
	AIOBackend string                `qp:"name=aio"`
	Locking    qpoption.Option[bool] ``
}

FileBlockDevice specifies a protocol-level block driver for accessing regular files.

<https://man.archlinux.org/man/qemu.1.en#Driver>

func (FileBlockDevice) GetCliArgs

func (d FileBlockDevice) GetCliArgs() ([]string, error)

func (FileBlockDevice) GetFiles

func (d FileBlockDevice) GetFiles() []libqatapult.File

type FileCharDevice

type FileCharDevice struct{ PathCharDevice }

func (FileCharDevice) GetCliArgs

func (d FileCharDevice) GetCliArgs() ([]string, error)

type GenericBlockDevice

type GenericBlockDevice struct {
	BlockDevice
	Properties map[string]any
}

GenericBlockDevice specifies a generic protocol-level block driver.

<https://man.archlinux.org/man/qemu.1.en#Driver>

func (GenericBlockDevice) GetCliArgs

func (d GenericBlockDevice) GetCliArgs() ([]string, error)

type GenericDevice

type GenericDevice struct {
	Option     string   `qp:"~skip"`
	Arguments  []string `qp:"~unnamed,~repeat"`
	Properties map[string]any
}

GenericDevice represents a generic device option that has no specific implementation yet.

func (GenericDevice) GetCliArgs

func (d GenericDevice) GetCliArgs() ([]string, error)

type IDECDStorageDevice

type IDECDStorageDevice struct {
	StorageDevice
}

IDECDStorageDevice represents an IDE CD-ROM StorageDevice node.

func (IDECDStorageDevice) GetCliArgs

func (d IDECDStorageDevice) GetCliArgs() ([]string, error)

type IDEHDStorageDevice

type IDEHDStorageDevice struct {
	StorageDevice
}

IDEHDStorageDevice represents an IDE Hard Disk StorageDevice node.

func (IDEHDStorageDevice) GetCliArgs

func (d IDEHDStorageDevice) GetCliArgs() ([]string, error)

type Identifiers

type Identifiers struct {
	Name string    `qp:"opt=name,~unnamed"`
	UUID uuid.UUID `qp:"opt=uuid,~unnamed"`
}

func (Identifiers) GetCliArgs

func (d Identifiers) GetCliArgs() ([]string, error)

type InetSocket

type InetSocket struct {
	CharDevice

	Port    qpoption.Option[uint16] `qp:""`
	Host    string                  `qp:""`
	UseIPv4 qpoption.Option[bool]   `qp:"name=ipv4"`
	UseIPv6 qpoption.Option[bool]   `qp:"name=ipv6"`
}

type KVM

type KVM struct{}

func (KVM) GetCliArgs

func (d KVM) GetCliArgs() ([]string, error)

type LinuxKernel

type LinuxKernel struct {
	Kernel     libqatapult.File `qp:"opt='kernel',~unnamed"`
	InitRd     libqatapult.File `qp:"opt='initrd',~unnamed"`
	KernelArgs []string         `qp:"opt='append',~unnamed,join=' '"`
}

func (LinuxKernel) GetCliArgs

func (l LinuxKernel) GetCliArgs() ([]string, error)

func (LinuxKernel) GetFiles

func (l LinuxKernel) GetFiles() []libqatapult.File

type Machine

type Machine struct {
	Type          string                `qp:""`
	Accelerators  []string              `qp:"name=accel,join=':'"`
	DumpGuestCore bool                  `qp:"name=dump-guest-core"`
	HMAT          qpoption.Option[bool] `qp:""`
	// contains filtered or unexported fields
}

func (Machine) GetCliArgs

func (d Machine) GetCliArgs() ([]string, error)

type NamedDevice

type NamedDevice interface {
	libqatapult.Device
	GetName() string
}

type NetworkDevice

type NetworkDevice struct {
	Model string `qp:"~unnamed"`

	BootableDevice

	Index uint32 `qp:"~skip"`

	MACAddress net.HardwareAddr `qp:"name=mac"`
	Peer       Reference        `qp:"name=netdev"`
}

NetworkDevice describes a single network interface controller hardware device to the virtual machine.

A NetworkDevice needs to be backed by a NetworkPeerDevice peer.

func (NetworkDevice) GetCliArgs

func (d NetworkDevice) GetCliArgs() ([]string, error)

type NetworkPeerDevice

type NetworkPeerDevice struct {
	Type string `qp:"~unnamed"`
	Name string `qp:"name=id"`
	// contains filtered or unexported fields
}

func (NetworkPeerDevice) GetName

func (d NetworkPeerDevice) GetName() string

type NetworkTAPPeerDevice

type NetworkTAPPeerDevice struct {
	NetworkPeerDevice

	// One or more file descriptors pointing to an open TAP device.
	Queues []libqatapult.File `qp:"~skip"`

	// FileDescriptors describes the numerical file descriptors
	// to be passed to qemu.  This option will be set by GetCliArgs
	// from Queues.
	FileDescriptors []int `qp:"name=fds,join=':'"`
}

NetworkTAPPeerDevice describes a TAP peer device to the virtual machine.

func NewNetworkTAPPeerDevice

func NewNetworkTAPPeerDevice(name string, queues []libqatapult.File) *NetworkTAPPeerDevice

func (*NetworkTAPPeerDevice) GetCliArgs

func (d *NetworkTAPPeerDevice) GetCliArgs() ([]string, error)

func (*NetworkTAPPeerDevice) GetFiles

func (d *NetworkTAPPeerDevice) GetFiles() []libqatapult.File

type NetworkUserPeerDevice

type NetworkUserPeerDevice struct {
	NetworkPeerDevice
	Net       *net.IPNet
	DhcpStart net.IP
	HostFwd   []string `qp:"~repeat"`
	GuestFwd  []string `qp:"~repeat"`
}

NetworkUserPeerDevice describes a user mode host network peer device to the virtual machine.

func (NetworkUserPeerDevice) GetCliArgs

func (d NetworkUserPeerDevice) GetCliArgs() ([]string, error)

type NullCharDevice

type NullCharDevice struct{ CharDevice }

func (NullCharDevice) GetCliArgs

func (d NullCharDevice) GetCliArgs() ([]string, error)

type NvmeNsStorageDevice

type NvmeNsStorageDevice struct {
	StorageDevice

	// EUI64 is the EUI-64 of the namespace.
	EUI64 uint64

	// UUID is the UUID of the namespace.
	UUID uuid.UUID
}

NvmeNsStorageDevice represents an NVME Namespace StorageDevice node.

func (NvmeNsStorageDevice) GetCliArgs

func (d NvmeNsStorageDevice) GetCliArgs() ([]string, error)

type NvmeStorageDevice

type NvmeStorageDevice struct {
	StorageDevice

	Serial string
}

NvmeStorageDevice represents an NVME StorageDevice node.

func (NvmeStorageDevice) GetCliArgs

func (d NvmeStorageDevice) GetCliArgs() ([]string, error)

type PathCharDevice

type PathCharDevice struct {
	CharDevice
	Path string
}

type PipeCharDevice

type PipeCharDevice struct{ PathCharDevice }

func (PipeCharDevice) GetCliArgs

func (d PipeCharDevice) GetCliArgs() ([]string, error)

type QCOW2FileBlockDevice

type QCOW2FileBlockDevice struct {
	BlockDevice
	File                Reference
	Backing             Reference
	LazyRefcounts       qpoption.Option[bool] `qp:"~kebab"`
	CacheSize           qpoption.Option[int]  `qp:"~kebab"`
	L2CacheSize         qpoption.Option[int]  `qp:"~kebab"`
	RefcountCacheSize   qpoption.Option[int]  `qp:"~kebab"`
	CacheCleanInterval  qpoption.Option[int]  `qp:"~kebab"`
	PassDiscardRequest  qpoption.Option[bool] `qp:"~kebab"`
	PassDiscardSnapshot qpoption.Option[bool] `qp:"~kebab"`
	PassDiscardOther    qpoption.Option[bool] `qp:"~kebab"`
	OverlapCheck        string                `qp:"~kebab"`
}

QCOW2FileBlockDevice is a raw image format driver, stacked on top of a protocol level block driver such as FileBlockDevice.

<https://man.archlinux.org/man/qemu.1.en#Driver~3>

func (QCOW2FileBlockDevice) GetCliArgs

func (d QCOW2FileBlockDevice) GetCliArgs() ([]string, error)

type RAM

type RAM struct {
	Size, Slots, MaxMem int `qp:"opt=m"`
}

func (RAM) GetCliArgs

func (d RAM) GetCliArgs() ([]string, error)

type RawFileBlockDevice

type RawFileBlockDevice struct {
	BlockDevice
	File   Reference
	Offset qpoption.Option[int]
	Size   qpoption.Option[int]
}

RawFileBlockDevice is a raw image format driver, stacked on top of a protocol level block driver such as FileBlockDevice.

<https://man.archlinux.org/man/qemu.1.en#Driver~2>

func (RawFileBlockDevice) GetCliArgs

func (d RawFileBlockDevice) GetCliArgs() ([]string, error)

type Reference

type Reference string

func Ref

func Ref(d NamedDevice) Reference

Ref returns a Reference to the given NamedDevice.

func (Reference) PointingTo

func (r Reference) PointingTo() string

type SCSICDStorageDevice

type SCSICDStorageDevice struct {
	SCSIStorageDevice
}

SCSICDStorageDevice represents a SCSI CD-ROM StorageDevice node.

func (SCSICDStorageDevice) GetCliArgs

func (d SCSICDStorageDevice) GetCliArgs() ([]string, error)

type SCSIHDStorageDevice

type SCSIHDStorageDevice struct {
	SCSIStorageDevice
}

SCSIHDStorageDevice represents a SCSI Hard Disk StorageDevice node.

func (SCSIHDStorageDevice) GetCliArgs

func (d SCSIHDStorageDevice) GetCliArgs() ([]string, error)

type SCSIStorageDevice

type SCSIStorageDevice struct {
	StorageDevice

	// Channel is the SCSI Channel Number of the device in the HBTL SCSI address scheme.
	Channel qpoption.Option[uint32]

	// Target is the SCSI ID of the device in the HBTL SCSI address scheme.
	Target qpoption.Option[uint32] `qp:"name=scsi-id"`

	// LUN is the SCSI Logical Unit Number of the device in the HBTL SCSI address scheme.
	LUN qpoption.Option[uint32]
}

type SMP

type SMP struct {
	CPUs, MaxCPUs, Sockets, Dies, Clusters, Cores, Threads qpoption.Option[int] `qp:"opt=smp"`
}

func (SMP) GetCliArgs

func (d SMP) GetCliArgs() ([]string, error)

type SerialCharDevice

type SerialCharDevice struct{ PathCharDevice }

func (SerialCharDevice) GetCliArgs

func (d SerialCharDevice) GetCliArgs() ([]string, error)

type SocketCharDevice

type SocketCharDevice struct {
	Server       qpoption.Option[bool]          `qp:""`
	Wait         qpoption.Option[bool]          `qp:""`
	UseTelnet    qpoption.Option[bool]          `qp:"name=telnet"`
	UseWebsocket qpoption.Option[bool]          `qp:"name=websocket"`
	Reconnect    qpoption.Option[time.Duration] `qp:""`
}

type SocketPairDevice

type SocketPairDevice struct {
	// contains filtered or unexported fields
}

SocketPairDevice is a special device that creates a unix.Socketpair which connects the right side of the pair to the virtual machine as a CharDevice and the left side stays usable for the host system.

func NewSocketPair

func NewSocketPair(name string, typ, proto int) (c *SocketPairDevice, err error)

func (*SocketPairDevice) Close

func (d *SocketPairDevice) Close() error

func (*SocketPairDevice) GetCliArgs

func (d *SocketPairDevice) GetCliArgs() ([]string, error)

func (*SocketPairDevice) GetFiles

func (d *SocketPairDevice) GetFiles() []libqatapult.File

func (*SocketPairDevice) GetName

func (d *SocketPairDevice) GetName() string

func (*SocketPairDevice) LocalFile

func (d *SocketPairDevice) LocalFile() *os.File

type StorageDevice

type StorageDevice struct {
	BaseDevice
	BootableDevice

	// Drive is the underlying BlockDevice name to be used as the backend.
	Drive Reference

	// Bus is the bus this StorageDevice will be connected to.
	Bus string
}

StorageDevice represents a generic storage device.

func (StorageDevice) GetCliArgs

func (d StorageDevice) GetCliArgs() ([]string, error)

func (StorageDevice) GetName

func (d StorageDevice) GetName() string

type TCPSocketCharDevice

type TCPSocketCharDevice struct {
	InetSocket
	SocketCharDevice

	ToPort  qpoption.Option[uint16] `qp:"name=to"`
	NoDelay qpoption.Option[bool]   `qp:"name=ipv6"`
}

func (TCPSocketCharDevice) GetCliArgs

func (d TCPSocketCharDevice) GetCliArgs() ([]string, error)

type UDPSocketCharDevice

type UDPSocketCharDevice struct {
	InetSocket

	LocalAddr net.IP
	LocalPort uint16
}

func (UDPSocketCharDevice) GetCliArgs

func (d UDPSocketCharDevice) GetCliArgs() ([]string, error)

type UnixSocketCharDevice

type UnixSocketCharDevice struct {
	CharDevice
	SocketCharDevice

	Path     string                `qp:""`
	Abstract qpoption.Option[bool] `qp:"name=ipv4"`
	Tight    qpoption.Option[bool] `qp:"name=ipv6"`
}

func (UnixSocketCharDevice) GetCliArgs

func (d UnixSocketCharDevice) GetCliArgs() ([]string, error)

type VirtIOSCSIPCIDevice

type VirtIOSCSIPCIDevice struct {
	BaseDevice
}

func (VirtIOSCSIPCIDevice) GetCliArgs

func (d VirtIOSCSIPCIDevice) GetCliArgs() ([]string, error)

Jump to

Keyboard shortcuts

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