qmp

package
v0.0.0-...-f8639d9 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMonitorBadConsole = fmt.Errorf("Requested console couldn't be found")

ErrMonitorBadConsole is retuned when the requested console doesn't exist.

View Source
var ErrMonitorDisconnect = fmt.Errorf("Monitor is disconnected")

ErrMonitorDisconnect is returned when interacting with a disconnected Monitor.

View Source
var EventAgentStarted = "LXD-AGENT-STARTED"

EventAgentStarted is the event sent once the lxd-agent has started.

View Source
var EventVMShutdown = "SHUTDOWN"

EventVMShutdown is the event sent when VM guest shuts down.

View Source
var EventVMShutdownReasonDisconnect = "disconnect"

EventVMShutdownReasonDisconnect is used as the reason when the shutdown event is triggered by a QMP disconnect.

View Source
var RingbufSize = 16

RingbufSize is the size of the agent serial ringbuffer in bytes.

Functions

This section is empty.

Types

type AMDSEVCapabilities

type AMDSEVCapabilities struct {
	PDH             string `json:"pdh"`               // Platform Diffie-Hellman key (base64-encoded)
	CertChain       string `json:"cert-chain"`        // PDH certificate chain (base64-encoded)
	CPU0Id          string `json:"cpu0-id"`           // Unique ID of CPU0 (base64-encoded)
	CBitPos         int    `json:"cbitpos"`           // C-bit location in page table entry
	ReducedPhysBits int    `json:"reduced-phys-bits"` // Number of physical address bit reduction when SEV is enabled
}

AMDSEVCapabilities represents the SEV capabilities of QEMU.

type AddFdInfo

type AddFdInfo struct {
	ID int `json:"fdset-id"`
	FD int `json:"fd"`
}

AddFdInfo contains information about a file descriptor that was added to an fd set.

type BlockStats

type BlockStats struct {
	BytesWritten    int `json:"wr_bytes"`
	WritesCompleted int `json:"wr_operations"`
	BytesRead       int `json:"rd_bytes"`
	ReadsCompleted  int `json:"rd_operations"`
}

BlockStats represents block device stats.

type CPU

type CPU struct {
	Index    int    `json:"cpu-index,omitempty"`
	QOMPath  string `json:"qom-path,omitempty"`
	ThreadID int    `json:"thread-id,omitempty"`
	Target   string `json:"target,omitempty"`

	Props CPUInstanceProperties `json:"props"`
}

CPU contains information about a CPU.

type CPUInstanceProperties

type CPUInstanceProperties struct {
	NodeID    int `json:"node-id,omitempty"`
	SocketID  int `json:"socket-id,omitempty"`
	DieID     int `json:"die-id,omitempty"`
	ClusterID int `json:"cluster-id,omitempty"`
	CoreID    int `json:"core-id,omitempty"`
	ThreadID  int `json:"thread-id,omitempty"`
}

CPUInstanceProperties contains CPU instance properties.

type FdsetFdInfo

type FdsetFdInfo struct {
	FD     int    `json:"fd"`
	Opaque string `json:"opaque"`
}

FdsetFdInfo contains information about a file descriptor that belongs to an FD set.

type FdsetInfo

type FdsetInfo struct {
	ID  int           `json:"fdset-id"`
	FDs []FdsetFdInfo `json:"fds"`
}

FdsetInfo contains information about an FD set.

type HotpluggableCPU

type HotpluggableCPU struct {
	Type       string `json:"type"`
	VCPUsCount int    `json:"vcpus-count"`
	QOMPath    string `json:"qom-path,omitempty"`

	Props CPUInstanceProperties `json:"props"`
}

HotpluggableCPU contains information about a hotpluggable CPU.

type Monitor

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

Monitor represents a QMP monitor.

func Connect

func Connect(path string, serialCharDev string, eventHandler func(name string, data map[string]any)) (*Monitor, error)

Connect creates or retrieves an existing QMP monitor for the path.

func (*Monitor) AddBlockDevice

func (m *Monitor) AddBlockDevice(blockDev map[string]any, device map[string]string) error

AddBlockDevice adds a block device.

func (*Monitor) AddCharDevice

func (m *Monitor) AddCharDevice(device map[string]any) error

AddCharDevice adds a new character device.

func (*Monitor) AddDevice

func (m *Monitor) AddDevice(device map[string]string) error

AddDevice adds a new device.

func (*Monitor) AddNIC

func (m *Monitor) AddNIC(netDev map[string]any, device map[string]string) error

AddNIC adds a NIC device.

func (*Monitor) AddSecret

func (m *Monitor) AddSecret(id string, secret string) error

AddSecret adds a secret object with the given ID and secret. This function won't return an error if the secret object already exists.

func (*Monitor) AgenStarted

func (m *Monitor) AgenStarted() bool

AgenStarted indicates whether an agent has been detected.

func (*Monitor) BlockCommit

func (m *Monitor) BlockCommit(deviceNodeName string) error

BlockCommit merges a snapshot device back into its parent device.

func (*Monitor) BlockDevMirror

func (m *Monitor) BlockDevMirror(deviceNodeName string, targetNodeName string) error

BlockDevMirror mirrors the top device to the target device.

func (*Monitor) BlockDevSnapshot

func (m *Monitor) BlockDevSnapshot(deviceNodeName string, snapshotNodeName string) error

BlockDevSnapshot creates a snapshot of a device using the specified snapshot device.

func (*Monitor) BlockJobCancel

func (m *Monitor) BlockJobCancel(deviceNodeName string) error

BlockJobCancel cancels an ongoing block job.

func (*Monitor) BlockJobComplete

func (m *Monitor) BlockJobComplete(deviceNodeName string) error

BlockJobComplete completes a block job that is in reader state.

func (*Monitor) CloseFile

func (m *Monitor) CloseFile(name string) error

CloseFile closes an existing file descriptor in the QMP fd table associated to name.

func (*Monitor) Disconnect

func (m *Monitor) Disconnect()

Disconnect forces a disconnection from QEMU.

func (*Monitor) Eject

func (m *Monitor) Eject(id string) error

Eject ejects a removable drive.

func (*Monitor) GetBlockStats

func (m *Monitor) GetBlockStats() (map[string]BlockStats, error)

GetBlockStats return block device stats.

func (*Monitor) GetCPUs

func (m *Monitor) GetCPUs() ([]int, error)

GetCPUs fetches the vCPU information for pinning.

func (*Monitor) GetMemoryBalloonSizeBytes

func (m *Monitor) GetMemoryBalloonSizeBytes() (int64, error)

GetMemoryBalloonSizeBytes returns effective size of the memory in bytes (considering the current balloon size).

func (*Monitor) GetMemorySizeBytes

func (m *Monitor) GetMemorySizeBytes() (int64, error)

GetMemorySizeBytes returns the current size of the base memory in bytes.

func (*Monitor) Migrate

func (m *Monitor) Migrate(uri string) error

Migrate starts a migration stream.

func (*Monitor) MigrateContinue

func (m *Monitor) MigrateContinue(fromState string) error

MigrateContinue continues a migration stream.

func (*Monitor) MigrateIncoming

func (m *Monitor) MigrateIncoming(ctx context.Context, uri string) error

MigrateIncoming starts the receiver of a migration stream.

func (*Monitor) MigrateSetCapabilities

func (m *Monitor) MigrateSetCapabilities(caps map[string]bool) error

MigrateSetCapabilities sets the capabilities used during migration.

func (*Monitor) MigrateWait

func (m *Monitor) MigrateWait(state string) error

MigrateWait waits until migration job reaches the specified status. Returns nil if the migraton job reaches the specified status or an error if the migration job is in the failed status.

func (*Monitor) NBDBlockExportAdd

func (m *Monitor) NBDBlockExportAdd(deviceNodeName string) error

NBDBlockExportAdd exports a writable device via the NBD server.

func (*Monitor) NBDServerStart

func (m *Monitor) NBDServerStart() (net.Conn, error)

NBDServerStart starts internal NBD server and returns a connection to it.

func (*Monitor) NBDServerStop

func (m *Monitor) NBDServerStop() error

NBDServerStop stops the internal NBD server.

func (*Monitor) Pause

func (m *Monitor) Pause() error

Pause tells QEMU to temporarily stop the emulation.

func (*Monitor) Powerdown

func (m *Monitor) Powerdown() error

Powerdown tells the VM to gracefully shutdown.

func (*Monitor) QueryCPUs

func (m *Monitor) QueryCPUs() ([]CPU, error)

QueryCPUs returns a list of CPUs.

func (*Monitor) QueryHotpluggableCPUs

func (m *Monitor) QueryHotpluggableCPUs() ([]HotpluggableCPU, error)

QueryHotpluggableCPUs returns a list of hotpluggable CPUs.

func (*Monitor) QueryPCI

func (m *Monitor) QueryPCI() ([]PCIDevice, error)

QueryPCI returns info about PCI devices.

func (*Monitor) Quit

func (m *Monitor) Quit() error

Quit tells QEMU to exit immediately.

func (*Monitor) RemoveBlockDevice

func (m *Monitor) RemoveBlockDevice(blockDevName string) error

RemoveBlockDevice removes a block device.

func (*Monitor) RemoveCharDevice

func (m *Monitor) RemoveCharDevice(deviceID string) error

RemoveCharDevice removes a character device.

func (*Monitor) RemoveDevice

func (m *Monitor) RemoveDevice(deviceID string) error

RemoveDevice removes a device.

func (*Monitor) RemoveFDFromFDSet

func (m *Monitor) RemoveFDFromFDSet(name string) error

RemoveFDFromFDSet removes an FD with the given name from an FD set.

func (*Monitor) RemoveNIC

func (m *Monitor) RemoveNIC(netDevID string) error

RemoveNIC removes a NIC device.

func (*Monitor) Reset

func (m *Monitor) Reset() error

Reset VM.

func (*Monitor) SEVCapabilities

func (m *Monitor) SEVCapabilities() (AMDSEVCapabilities, error)

SEVCapabilities is used to get the SEV capabilities, and is supported on AMD X86 platforms only.

func (*Monitor) SendFile

func (m *Monitor) SendFile(name string, file *os.File) error

SendFile adds a new file descriptor to the QMP fd table associated to name.

func (*Monitor) SendFileWithFDSet

func (m *Monitor) SendFileWithFDSet(name string, file *os.File, readonly bool) (*AddFdInfo, error)

SendFileWithFDSet adds a new file descriptor to an FD set.

func (*Monitor) SetAction

func (m *Monitor) SetAction(actions map[string]string) error

SetAction sets the actions the VM will take for certain scenarios.

func (*Monitor) SetBlockThrottle

func (m *Monitor) SetBlockThrottle(id string, bytesRead int, bytesWrite int, iopsRead int, iopsWrite int) error

SetBlockThrottle applies an I/O limit on a disk.

func (*Monitor) SetMemoryBalloonSizeBytes

func (m *Monitor) SetMemoryBalloonSizeBytes(sizeBytes int64) error

SetMemoryBalloonSizeBytes sets the size of the memory in bytes (which will resize the balloon as needed).

func (*Monitor) SetOnDisconnectEvent

func (m *Monitor) SetOnDisconnectEvent(enable bool)

SetOnDisconnectEvent enables or disables the on disconnect event.

func (*Monitor) Start

func (m *Monitor) Start() error

Start tells QEMU to start the emulation.

func (*Monitor) Status

func (m *Monitor) Status() (string, error)

Status returns the current VM status.

func (*Monitor) Wait

func (m *Monitor) Wait() (chan struct{}, error)

Wait returns a channel that will be closed on disconnection.

type PCIBridge

type PCIBridge struct {
	Devices []PCIDevice `json:"devices"`
}

PCIBridge represents a PCI bridge.

type PCIClassInfo

type PCIClassInfo struct {
	Class       int    `json:"class"`
	Description string `json:"desc"`
}

PCIClassInfo info about a device's class.

type PCIDevice

type PCIDevice struct {
	DevID    string       `json:"qdev_id"`
	Bus      int          `json:"bus"`
	Slot     int          `json:"slot"`
	Function int          `json:"function"`
	Devices  []PCIDevice  `json:"devices"`
	Class    PCIClassInfo `json:"class_info"`
	Bridge   PCIBridge    `json:"pci_bridge"`
}

PCIDevice represents a PCI device.

Jump to

Keyboard shortcuts

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