qemu

package
v4.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

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

Variables

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

Functions

func GetQemuProvider

func GetQemuProvider() machine.Provider

func GetVMInfos

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

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
	// Mounts is the list of remote filesystems to mount
	Mounts []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 Monitor
	// RemoteUsername of the vm user
	RemoteUsername string
}

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) 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

type Mount

type Mount struct {
	Type     string
	Tag      string
	Source   string
	Target   string
	ReadOnly bool
}

type Provider

type Provider struct{}

func (*Provider) CheckExclusiveActiveVM

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

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

func (*Provider) IsValidVMName

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

func (*Provider) List

List lists all vm's that use qemu virtualization

func (*Provider) LoadVMByName

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

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

func (*Provider) NewMachine

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

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

Jump to

Keyboard shortcuts

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