qemu

package
v3.4.10 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CheckActiveVM

func CheckActiveVM() (bool, string, error)

CheckActiveVM checks if there is a VM already running

func GetVMInfos

func GetVMInfos() ([]*machine.ListResponse, error)

func IsValidVMName

func IsValidVMName(name string) (bool, error)

func List

List lists all vm's that use qemu virtualization

func LoadVMByName

func LoadVMByName(name string) (machine.VM, error)

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

func NewMachine

func NewMachine(opts machine.InitOptions) (machine.VM, error)

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

Types

type MachineVM

type MachineVM struct {
	// CPUs to be assigned to the VM
	CPUs uint64
	// The command line representation of the qemu command
	CmdLine []string
	// 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 Monitor
	// RemoteUsername of the vm user
	RemoteUsername string
}

func (*MachineVM) Init

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

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

func (*MachineVM) Remove

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

func (*MachineVM) SSH

func (v *MachineVM) SSH(name 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) Start

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

Start executes the qemu command line and forks it

func (*MachineVM) Stop

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

Stop uses the qmp monitor to call a system_powerdown

type Monitor

type Monitor 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
}

func NewQMPMonitor

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

NewQMPMonitor creates the monitor subsection of our vm

Jump to

Keyboard shortcuts

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