Documentation
¶
Index ¶
- Constants
- Variables
- func GetQemuProvider() machine.Provider
- type HostUser
- type ImageConfig
- type MachineFile
- type MachineVM
- func (v *MachineVM) Init(opts machine.InitOptions) (bool, error)
- func (v *MachineVM) Remove(_ string, opts machine.RemoveOptions) (string, func() error, error)
- func (v *MachineVM) SSH(_ string, opts machine.SSHOptions) error
- func (v *MachineVM) Set(_ string, opts machine.SetOptions) error
- func (v *MachineVM) Start(name string, _ machine.StartOptions) error
- func (v *MachineVM) State(bypass bool) (machine.Status, error)
- func (v *MachineVM) Stop(_ string, _ machine.StopOptions) error
- type MachineVMV1deprecated
- type Monitor
- type Monitorv1
- type Mount
- type Provider
- func (p *Provider) CheckExclusiveActiveVM() (bool, string, error)
- func (p *Provider) IsValidVMName(name string) (bool, error)
- func (p *Provider) List(_ machine.ListOptions) ([]*machine.ListResponse, error)
- func (p *Provider) LoadVMByName(name string) (machine.VM, error)
- func (p *Provider) NewMachine(opts machine.InitOptions) (machine.VM, error)
- type ResourceConfig
- type SSHConfig
Constants ¶
const ( // FCOS streams // Testing FCOS stream Testing string = "testing" // Next FCOS stream Next string = "next" // Stable FCOS stream Stable string = "stable" )
const ( VolumeTypeVirtfs = "virtfs" MountType9p = "9p" )
Variables ¶
var (
QemuCommand = "qemu-system-x86_64"
)
Functions ¶
func GetQemuProvider ¶
Types ¶
type HostUser ¶
type HostUser struct {
// 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
}
HostUser describes the host user
type ImageConfig ¶
type ImageConfig struct {
IgnitionFilePath MachineFile
// ImageStream is the update stream for the image
ImageStream string
// ImagePath is the fq path to
ImagePath MachineFile
}
ImageConfig describes the bootable image for the VM
type MachineFile ¶
type MachineFile struct {
// Path is the fully qualified path to a file
Path string
// Symlink is a shortened version of Path by using
// a symlink
Symlink *string
}
func NewMachineFile ¶
func NewMachineFile(path string, symlink *string) (*MachineFile, error)
NewMachineFile is a constructor for MachineFile
func (*MachineFile) Delete ¶
func (m *MachineFile) Delete() error
Delete removes the machinefile symlink (if it exists) and the actual path
func (*MachineFile) GetPath ¶
func (m *MachineFile) GetPath() string
GetPath returns the working path for a machinefile. it returns the symlink unless one does not exist
func (*MachineFile) Read ¶
func (m *MachineFile) Read() ([]byte, error)
Read the contents of a given file and return in []bytes
type MachineVM ¶
type MachineVM struct {
// ConfigPath is the path to the configuration file
ConfigPath MachineFile
// The command line representation of the qemu command
CmdLine []string
// HostUser contains info about host user
HostUser
// ImageConfig describes the bootable image
ImageConfig
// Mounts is the list of remote filesystems to mount
Mounts []Mount
// Name of VM
Name string
// PidFilePath is the where the PID file lives
PidFilePath MachineFile
// QMPMonitor is the qemu monitor object for sending commands
QMPMonitor Monitor
// ReadySocket tells host when vm is booted
ReadySocket MachineFile
// ResourceConfig is physical attrs of the VM
ResourceConfig
// SSHConfig for accessing the remote vm
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
}
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 ¶
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) Start ¶
func (v *MachineVM) Start(name string, _ machine.StartOptions) error
Start executes the qemu command line and forks it
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 []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 MachineFile
// Network portion of the qmp monitor (unix)
Network string
// Timeout in seconds for qmp monitor transactions
Timeout time.Duration
}
type Provider ¶
type Provider struct{}
func (*Provider) CheckExclusiveActiveVM ¶
CheckExclusiveActiveVM checks if there is a VM already running that does not allow other VMs to be running
func (*Provider) List ¶
func (p *Provider) List(_ machine.ListOptions) ([]*machine.ListResponse, error)
List lists all vm's that use qemu virtualization
func (*Provider) LoadVMByName ¶
LoadVMByName reads a json file that describes a known qemu vm and returns a vm instance
func (*Provider) NewMachine ¶
NewMachine initializes an instance of a virtual machine based on the qemu virtualization.
type ResourceConfig ¶
type ResourceConfig struct {
// CPUs to be assigned to the VM
CPUs uint64
// Memory in megabytes assigned to the vm
Memory uint64
// Disk size in gigabytes assigned to the vm
DiskSize uint64
}
ResourceConfig describes physical attributes of the machine