Documentation ¶
Index ¶
- Constants
- Variables
- func LoadMachinesInDir(dirs *define.MachineDirs) (map[string]*MachineConfig, error)
- func NormalizeMachineArch(arch string) (string, error)
- func SplitVolume(idx int, volume string) (string, string, string, bool, string)
- type AppleHVConfig
- type HostUser
- type HyperVConfig
- type LibKrunConfig
- type MachineConfig
- func (mc *MachineConfig) APISocket() (*define.VMFile, error)
- func (mc *MachineConfig) ConfigDir() (*define.VMFile, error)
- func (mc *MachineConfig) ConnectionInfo(vmtype define.VMType) (*define.VMFile, *define.VMFile, error)
- func (mc *MachineConfig) DataDir() (*define.VMFile, error)
- func (mc *MachineConfig) GVProxySocket() (*define.VMFile, error)
- func (mc *MachineConfig) IgnitionFile() (*define.VMFile, error)
- func (mc *MachineConfig) IsFirstBoot() (bool, error)
- func (mc *MachineConfig) Kind() (define.VMType, error)
- func (mc *MachineConfig) Lock()
- func (mc *MachineConfig) LogFile() (*define.VMFile, error)
- func (mc *MachineConfig) ReadySocket() (*define.VMFile, error)
- func (mc *MachineConfig) Refresh() error
- func (mc *MachineConfig) Remove(machines map[string]bool, saveIgnition, saveImage bool) ([]string, func() error, error)
- func (mc *MachineConfig) RuntimeDir() (*define.VMFile, error)
- func (mc *MachineConfig) SetDirs(dirs *define.MachineDirs)
- func (mc *MachineConfig) SetRootful(rootful bool) error
- func (mc *MachineConfig) Unlock()
- func (mc *MachineConfig) Write() error
- type Mount
- type OCIMachineImage
- type QEMUConfig
- type RemoteConnectionType
- type ResourceConfig
- type SSHConfig
- type VMProvider
- type VMStats
- type VolumeMountType
- type WSLConfig
Constants ¶
const MachineConfigVersion = 1
Variables ¶
var ( SSHRemoteConnection RemoteConnectionType = "ssh" DefaultIgnitionUserName = "core" ForwarderBinaryName = "gvproxy" )
Functions ¶
func LoadMachinesInDir ¶
func LoadMachinesInDir(dirs *define.MachineDirs) (map[string]*MachineConfig, error)
LoadMachinesInDir returns all the machineconfigs located in given dir
func NormalizeMachineArch ¶
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 // Whether one of these fields has changed and actions should be taken Modified bool `json:"HostUserModified"` }
HostUser describes the host user
type HyperVConfig ¶
type HyperVConfig struct{}
type LibKrunConfig ¶ added in v5.1.0
type LibKrunConfig struct{}
type MachineConfig ¶
type MachineConfig struct { // Common stuff Created time.Time GvProxy gvproxy.GvproxyCommand HostUser HostUser LastUp time.Time Mounts []*Mount Name string Resources ResourceConfig SSH SSHConfig Version uint ImagePath *define.VMFile // Temporary only until a proper image struct is worked out // Provider stuff AppleHypervisor *AppleHVConfig `json:",omitempty"` HyperVHypervisor *HyperVConfig `json:",omitempty"` LibKrunHypervisor *LibKrunConfig `json:",omitempty"` QEMUHypervisor *QEMUConfig `json:",omitempty"` WSLHypervisor *WSLConfig `json:",omitempty"` // Starting is defined as "on" but not fully booted Starting bool Rosetta bool // contains filtered or unexported fields }
func LoadMachineByName ¶
func LoadMachineByName(name string, dirs *define.MachineDirs) (*MachineConfig, error)
LoadMachineByName returns a machine config based on the vm name and provider
func NewMachineConfig ¶
func NewMachineConfig(opts define.InitOptions, dirs *define.MachineDirs, sshIdentityPath string, vmtype define.VMType, machineLock *lockfile.LockFile) (*MachineConfig, error)
NewMachineConfig creates the initial machine configuration file from cli options.
func (*MachineConfig) ConfigDir ¶
func (mc *MachineConfig) ConfigDir() (*define.VMFile, error)
ConfigDir is a simple helper to obtain the machine config dir
func (*MachineConfig) ConnectionInfo ¶
func (*MachineConfig) DataDir ¶
func (mc *MachineConfig) DataDir() (*define.VMFile, error)
DataDir is a simple helper function to obtain the machine data dir
func (*MachineConfig) GVProxySocket ¶
func (mc *MachineConfig) GVProxySocket() (*define.VMFile, error)
func (*MachineConfig) IgnitionFile ¶
func (mc *MachineConfig) IgnitionFile() (*define.VMFile, error)
func (*MachineConfig) IsFirstBoot ¶
func (mc *MachineConfig) IsFirstBoot() (bool, error)
func (*MachineConfig) Lock ¶
func (mc *MachineConfig) Lock()
Lock creates a lock on the machine for single access
func (*MachineConfig) ReadySocket ¶
func (mc *MachineConfig) ReadySocket() (*define.VMFile, error)
func (*MachineConfig) Refresh ¶
func (mc *MachineConfig) Refresh() error
Refresh reloads the config file from disk
func (*MachineConfig) RuntimeDir ¶
func (mc *MachineConfig) RuntimeDir() (*define.VMFile, error)
RuntimeDir is simple helper function to obtain the runtime dir
func (*MachineConfig) SetDirs ¶
func (mc *MachineConfig) SetDirs(dirs *define.MachineDirs)
func (*MachineConfig) SetRootful ¶
func (mc *MachineConfig) SetRootful(rootful bool) error
func (*MachineConfig) Write ¶
func (mc *MachineConfig) Write() error
write is a non-locking way to write the machine configuration file to disk
type OCIMachineImage ¶
type OCIMachineImage struct { // quay.io/podman/podman-machine-image:5.0 FQImageReference string }
type QEMUConfig ¶
type RemoteConnectionType ¶
type RemoteConnectionType string
type ResourceConfig ¶
type ResourceConfig struct { // CPUs to be assigned to the VM CPUs uint64 // Disk size in gigabytes assigned to the vm DiskSize strongunits.GiB // Memory in megabytes assigned to the vm Memory strongunits.MiB // Usbs USBs []define.USBConfig }
ResourceConfig describes physical attributes of the machine
type SSHConfig ¶
type SSHConfig struct { // IdentityPath is the fq path to the ssh priv key IdentityPath string // SSH port for user networking Port int // RemoteUsername of the vm user RemoteUsername string }
SSHConfig contains remote access information for SSH
type VMProvider ¶
type VMProvider interface { CreateVM(opts define.CreateVMOpts, mc *MachineConfig, builder *ignition.IgnitionBuilder) error PrepareIgnition(mc *MachineConfig, ignBuilder *ignition.IgnitionBuilder) (*ignition.ReadyUnitOpts, error) Exists(name string) (bool, error) MountType() VolumeMountType MountVolumesToVM(mc *MachineConfig, quiet bool) error Remove(mc *MachineConfig) ([]string, func() error, error) RemoveAndCleanMachines(dirs *define.MachineDirs) error SetProviderAttrs(mc *MachineConfig, opts define.SetOptions) error StartNetworking(mc *MachineConfig, cmd *gvproxy.GvproxyCommand) error PostStartNetworking(mc *MachineConfig, noInfo bool) error StartVM(mc *MachineConfig) (func() error, func() error, error) State(mc *MachineConfig, bypass bool) (define.Status, error) StopVM(mc *MachineConfig, hardStop bool) error StopHostNetworking(mc *MachineConfig, vmType define.VMType) error VMType() define.VMType UserModeNetworkEnabled(mc *MachineConfig) bool UseProviderNetworkSetup() bool RequireExclusiveActive() bool UpdateSSHPort(mc *MachineConfig, port int) error GetRosetta(mc *MachineConfig) (bool, error) }
type VolumeMountType ¶
type VolumeMountType int
const ( NineP VolumeMountType = iota VirtIOFS Unknown )
func (VolumeMountType) String ¶
func (v VolumeMountType) String() string