qemu

package
v4.8.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	VolumeTypeVirtfs = "virtfs"
	MountType9p      = "9p"
)

Variables

View Source
var (
	QemuCommand = "qemu-system-x86_64"
)

Functions

func VirtualizationProvider added in v4.7.0

func VirtualizationProvider() machine.VirtProvider

Types

type MachineVM

type MachineVM struct {
	// ConfigPath is the path to the configuration file
	ConfigPath define.VMFile
	// The command line representation of the qemu command
	CmdLine QemuCmd
	// HostUser contains info about host user
	machine.HostUser
	// ImageConfig describes the bootable image
	machine.ImageConfig
	// Mounts is the list of remote filesystems to mount
	Mounts []machine.Mount
	// Name of VM
	Name string
	// PidFilePath is the where the Proxy PID file lives
	PidFilePath define.VMFile
	// VMPidFilePath is the where the VM PID file lives
	VMPidFilePath define.VMFile
	// QMPMonitor is the qemu monitor object for sending commands
	QMPMonitor Monitor
	// ReadySocket tells host when vm is booted
	ReadySocket define.VMFile
	// ResourceConfig is physical attrs of the VM
	machine.ResourceConfig
	// SSHConfig for accessing the remote vm
	machine.SSHConfig
	// Starting tells us whether the machine is running or if we have just dialed it to start it
	Starting bool
	// Created contains the original created time instead of querying the file mod time
	Created time.Time
	// LastUp contains the last recorded uptime
	LastUp time.Time
	// contains filtered or unexported fields
}

func (*MachineVM) Init

func (v *MachineVM) Init(opts machine.InitOptions) (bool, error)

Init writes the json configuration file to the filesystem for other verbs (start, stop)

func (*MachineVM) Inspect added in v4.1.0

func (v *MachineVM) Inspect() (*machine.InspectInfo, error)

Inspect returns verbose detail about the machine

func (*MachineVM) ProxyPID added in v4.7.0

func (v *MachineVM) ProxyPID() (int, error)

ProxyPID retrieves the pid from the proxy pidfile

func (*MachineVM) Remove

func (v *MachineVM) Remove(_ string, opts machine.RemoveOptions) (string, func() error, error)

Remove deletes all the files associated with a machine including ssh keys, the image itself

func (*MachineVM) SSH

func (v *MachineVM) SSH(_ string, opts machine.SSHOptions) error

SSH opens an interactive SSH session to the vm specified. Added ssh function to VM interface: pkg/machine/config/go : line 58

func (*MachineVM) Set

func (v *MachineVM) Set(_ string, opts machine.SetOptions) ([]error, error)

func (*MachineVM) Start

func (v *MachineVM) Start(name string, opts machine.StartOptions) error

Start executes the qemu command line and forks it

func (*MachineVM) State added in v4.1.0

func (v *MachineVM) State(bypass bool) (machine.Status, error)

func (*MachineVM) Stop

func (v *MachineVM) Stop(_ string, _ machine.StopOptions) error

Stop uses the qmp monitor to call a system_powerdown

func (*MachineVM) VMPid added in v4.7.0

func (v *MachineVM) VMPid() (int, error)

VMPid retrieves the pid from the VM's pidfile

type MachineVMV1 deprecated added in v4.1.0

type MachineVMV1 struct {
	// CPUs to be assigned to the VM
	CPUs uint64
	// The command line representation of the qemu command
	CmdLine []string
	// Mounts is the list of remote filesystems to mount
	Mounts []machine.Mount
	// IdentityPath is the fq path to the ssh priv key
	IdentityPath string
	// IgnitionFilePath is the fq path to the .ign file
	IgnitionFilePath string
	// ImageStream is the update stream for the image
	ImageStream string
	// ImagePath is the fq path to
	ImagePath string
	// Memory in megabytes assigned to the vm
	Memory uint64
	// Disk size in gigabytes assigned to the vm
	DiskSize uint64
	// Name of the vm
	Name string
	// SSH port for user networking
	Port int
	// QMPMonitor is the qemu monitor object for sending commands
	QMPMonitor Monitorv1
	// RemoteUsername of the vm user
	RemoteUsername string
	// Whether this machine should run in a rootful or rootless manner
	Rootful bool
	// UID is the numerical id of the user that called machine
	UID int
}

Deprecated: MachineVMV1 is being deprecated in favor a more flexible and informative structure

type Monitor

type Monitor struct {
	//	Address portion of the qmp monitor (/tmp/tmp.sock)
	Address define.VMFile
	// Network portion of the qmp monitor (unix)
	Network string
	// Timeout in seconds for qmp monitor transactions
	Timeout time.Duration
}

func NewQMPMonitor

func NewQMPMonitor(network, name string, timeout time.Duration) (Monitor, error)

NewQMPMonitor creates the monitor subsection of our vm

type Monitorv1 added in v4.1.0

type Monitorv1 struct {
	//	Address portion of the qmp monitor (/tmp/tmp.sock)
	Address string
	// Network portion of the qmp monitor (unix)
	Network string
	// Timeout in seconds for qmp monitor transactions
	Timeout time.Duration
}

type QEMUVirtualization added in v4.7.0

type QEMUVirtualization struct {
	machine.Virtualization
}

func (*QEMUVirtualization) CheckExclusiveActiveVM added in v4.7.0

func (p *QEMUVirtualization) CheckExclusiveActiveVM() (bool, string, error)

CheckExclusiveActiveVM checks if there is a VM already running that does not allow other VMs to be running

func (*QEMUVirtualization) IsValidVMName added in v4.7.0

func (p *QEMUVirtualization) IsValidVMName(name string) (bool, error)

func (*QEMUVirtualization) List added in v4.7.0

List lists all vm's that use qemu virtualization

func (*QEMUVirtualization) LoadVMByName added in v4.7.0

func (p *QEMUVirtualization) LoadVMByName(name string) (machine.VM, error)

LoadVMByName reads a json file that describes a known qemu vm and returns a vm instance

func (*QEMUVirtualization) NewMachine added in v4.7.0

func (p *QEMUVirtualization) NewMachine(opts machine.InitOptions) (machine.VM, error)

NewMachine initializes an instance of a virtual machine based on the qemu virtualization.

func (*QEMUVirtualization) RemoveAndCleanMachines added in v4.7.0

func (p *QEMUVirtualization) RemoveAndCleanMachines() error

RemoveAndCleanMachines removes all machine and cleans up any other files associated with podman machine

func (*QEMUVirtualization) VMType added in v4.7.0

func (p *QEMUVirtualization) VMType() machine.VMType

type QemuCmd added in v4.8.0

type QemuCmd []string

QemuCmd is an alias around a string slice to prevent the need to migrate the MachineVM struct due to changes

func NewQemuBuilder added in v4.8.0

func NewQemuBuilder(binary string, options []string) QemuCmd

NewQemuBuilder creates a new QemuCmd object that we will build on top of, starting with the qemu binary, architecture specific options, and propagated proxy and SSL settings

func (*QemuCmd) Build added in v4.8.0

func (q *QemuCmd) Build() []string

func (*QemuCmd) SetBootableImage added in v4.8.0

func (q *QemuCmd) SetBootableImage(image string)

SetBootableImage specifies the image the machine will use to boot

func (*QemuCmd) SetCPUs added in v4.8.0

func (q *QemuCmd) SetCPUs(c uint64)

SetCPUs adds the number of CPUs the machine will have

func (*QemuCmd) SetDisplay added in v4.8.0

func (q *QemuCmd) SetDisplay(display string)

SetDisplay specifies whether the machine will have a display

func (*QemuCmd) SetIgnitionFile added in v4.8.0

func (q *QemuCmd) SetIgnitionFile(file define.VMFile)

SetIgnitionFile specifies the machine's ignition file

func (*QemuCmd) SetMemory added in v4.8.0

func (q *QemuCmd) SetMemory(m uint64)

SetMemory adds the specified amount of memory for the machine

func (*QemuCmd) SetNetwork added in v4.8.0

func (q *QemuCmd) SetNetwork()

SetNetwork adds a network device to the machine

func (*QemuCmd) SetPropagatedHostEnvs added in v4.8.0

func (q *QemuCmd) SetPropagatedHostEnvs()

SetPropagatedHostEnvs adds options that propagate SSL and proxy settings

func (*QemuCmd) SetQmpMonitor added in v4.8.0

func (q *QemuCmd) SetQmpMonitor(monitor Monitor)

SetQmpMonitor specifies the machine's qmp socket

func (*QemuCmd) SetSerialPort added in v4.8.0

func (q *QemuCmd) SetSerialPort(readySocket, vmPidFile define.VMFile, name string)

SetSerialPort adds a serial port to the machine for readiness

func (*QemuCmd) SetUSBHostPassthrough added in v4.8.0

func (q *QemuCmd) SetUSBHostPassthrough(usbs []machine.USBConfig)

SetNetwork adds a network device to the machine

func (*QemuCmd) SetVirtfsMount added in v4.8.0

func (q *QemuCmd) SetVirtfsMount(source, tag, securityModel string, readonly bool)

SetVirtfsMount adds a virtfs mount to the machine

Jump to

Keyboard shortcuts

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