machine

package
v4.9.4 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 38 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Running indicates the qemu vm is running.
	Running Status = "running"
	// Stopped indicates the vm has stopped.
	Stopped Status = "stopped"
	// Starting indicated the vm is in the process of starting
	Starting Status = "starting"
	// Unknown means the state is not known
	Unknown            Status = "unknown"
	DefaultMachineName string = "podman-machine-default"
)
View Source
const (
	PodmanTestingHost = "fedorapeople.org"
	PodmanTestingURL  = "groups/podman/testing"
)
View Source
const (
	UserCertsTargetPath     = "/etc/containers/certs.d"
	PodmanDockerTmpConfPath = "/etc/tmpfiles.d/podman-docker.conf"
)
View Source
const LocalhostIP = "127.0.0.1"

Variables

View Source
var (
	SSHRemoteConnection     RemoteConnectionType = "ssh"
	DefaultIgnitionUserName                      = "core"
	ForwarderBinaryName                          = "gvproxy"
)
View Source
var (
	ErrNoSuchVM         = errors.New("VM does not exist")
	ErrWrongState       = errors.New("VM in wrong state to perform action")
	ErrVMAlreadyExists  = errors.New("VM already exists")
	ErrVMAlreadyRunning = errors.New("VM already running or starting")
	ErrMultipleActiveVM = errors.New("only one VM can be active at a time")
	ErrNotImplemented   = errors.New("functionality not implemented")
)

Functions

func AddConnection

func AddConnection(uri fmt.Stringer, name, identity string, isDefault bool) error

func AddSSHConnectionsToPodmanSocket added in v4.7.0

func AddSSHConnectionsToPodmanSocket(uid, port int, identityPath, name, remoteUsername string, opts InitOptions) error

AddSSHConnectionsToPodmanSocket adds SSH connections to the podman socket if no ignition path is provided

func AllocateMachinePort added in v4.7.0

func AllocateMachinePort() (int, error)

Reserves a unique port for a machine instance in a global (user) scope across all machines and backend types. On success the port is guaranteed to not be allocated until released with a call to ReleaseMachinePort().

The purpose of this method is to prevent collisions between machine instances when ran at the same time. Note, that dynamic port reassignment on its own is insufficient to resolve conflicts, since there is a narrow window between port detection and actual service binding, allowing for the possibility of a second racing machine to fail if its check is unlucky to fall within that window. Additionally, there is the potential for a long running reassignment dance over start/stop until all machine instances eventually arrive at total conflict free state. By reserving ports using mechanism these scenarios are prevented.

func AnyConnectionDefault

func AnyConnectionDefault(name ...string) (bool, error)

func BoolToPtr added in v4.6.0

func BoolToPtr(b bool) *bool

Convenience function to convert bool to ptr

func ChangeConnectionURI added in v4.7.0

func ChangeConnectionURI(name string, uri fmt.Stringer) error

func ChangeDefault

func ChangeDefault(name string) error

func CleanupGVProxy added in v4.7.0

func CleanupGVProxy(f define.VMFile) error

CleanupGVProxy reads the --pid-file for gvproxy attempts to stop it

func CommonSSH added in v4.6.0

func CommonSSH(username, identityPath, name string, sshPort int, inputArgs []string) error

CommonSSH is a common function for ssh'ing to a podman machine using system-connections and a port

func ConfDirPrefix added in v4.1.0

func ConfDirPrefix() (string, error)

ConfDirPrefix returns the path prefix for all machine config files

func CreateSSHKeys

func CreateSSHKeys(writeLocation string) (string, error)

CreateSSHKeys makes a priv and pub ssh key for interacting the a VM.

func CreateSSHKeysPrefix

func CreateSSHKeysPrefix(identityPath string, passThru bool, skipExisting bool, prefix ...string) (string, error)

func DataDirPrefix added in v4.1.0

func DataDirPrefix() (string, error)

DataDirPrefix returns the path prefix for all machine data files

func DetermineMachineArch added in v4.5.0

func DetermineMachineArch() string

func DialSocketWithBackoffs added in v4.8.0

func DialSocketWithBackoffs(maxBackoffs int, backoff time.Duration, socketPath string) (conn net.Conn, err error)

DialSocketWithBackoffs attempts to connect to the socket in maxBackoffs attempts

func DialSocketWithBackoffsAndProcCheck added in v4.8.0

func DialSocketWithBackoffsAndProcCheck(
	maxBackoffs int,
	backoff time.Duration,
	socketPath string,
	checkProccessStatus func(string, int, *bytes.Buffer) error,
	procHint string,
	procPid int,
	errBuf *bytes.Buffer,
) (conn net.Conn, err error)

DialSocketWithBackoffsAndProcCheck attempts to connect to the socket in maxBackoffs attempts. After every failure to connect, it makes sure the specified process is alive

func DownloadImage

func DownloadImage(d DistributionDownload) error

func DownloadVMImage

func DownloadVMImage(downloadURL *url2.URL, imageName string, localImagePath string) error

DownloadVMImage downloads a VM image from url to given path with download status

func EncodeDataURLPtr added in v4.6.0

func EncodeDataURLPtr(contents string) *string

func GetCacheDir added in v4.2.0

func GetCacheDir(vmType VMType) (string, error)

GetCacheDir returns the dir where VM images are downloaded into when pulled

func GetConfDir

func GetConfDir(vmType VMType) (string, error)

GetConfigDir returns the filepath to where configuration files for podman-machine should live

func GetDataDir

func GetDataDir(vmType VMType) (string, error)

GetDataDir returns the filepath where vm images should live for podman-machine.

func GetDevNullFiles added in v4.7.0

func GetDevNullFiles() (*os.File, *os.File, error)

GetDevNullFiles returns pointers to Read-only and Write-only DevNull files

func GetFcosArch added in v4.5.0

func GetFcosArch() string

func GetGlobalDataDir added in v4.7.0

func GetGlobalDataDir() (string, error)

GetGLobalDataDir returns the root of all backends for shared machine data.

func GetLock added in v4.8.0

func GetLock(name string, vmtype VMType) (*lockfile.LockFile, error)

func GetNetRecoveryFile added in v4.9.0

func GetNetRecoveryFile() string

func GetNetRecoveryUnitFile added in v4.9.0

func GetNetRecoveryUnitFile() *parser.UnitFile

func GetPodmanDockerTmpConfig added in v4.6.0

func GetPodmanDockerTmpConfig(uid int, rootful bool, newline bool) string

func GetProxyVariables

func GetProxyVariables() map[string]string

func IntToPtr added in v4.6.0

func IntToPtr(i int) *int

Convenience function to convert int to ptr

func IsLocalPortAvailable added in v4.7.0

func IsLocalPortAvailable(port int) bool

func IsValidFCOSStreamString added in v4.7.0

func IsValidFCOSStreamString(s string) bool

func ListenAndWaitOnSocket added in v4.8.0

func ListenAndWaitOnSocket(errChan chan<- error, listener net.Listener)

ListenAndWaitOnSocket waits for a new connection to the listener and sends any error back through the channel. ListenAndWaitOnSocket is intended to be used as a goroutine

func ParseVolumeFromPath added in v4.7.0

func ParseVolumeFromPath(v string) (source, target, options string, readonly bool, err error)

ParseVolumeFromPath is a oneshot parsing of a provided volume. It follows the "rules" of the singular parsing functions

func ReadySocketPath added in v4.8.0

func ReadySocketPath(runtimeDir, machineName string) string

ReadySocketPath returns the filepath for the ready socket

func ReleaseMachinePort added in v4.7.0

func ReleaseMachinePort(port int) error

Releases a reserved port for a machine when no longer required. Care should be taken to ensure there are no conditions (e.g. failure paths) where the port might unintentionally remain in use after releasing

func RemoveConnections added in v4.6.0

func RemoveConnections(names ...string) error

func RemoveFilesAndConnections added in v4.7.0

func RemoveFilesAndConnections(files []string, names ...string)

removeFilesAndConnections removes any files and connections with the given names

func RemoveImageAfterExpire added in v4.5.0

func RemoveImageAfterExpire(dir string, expire time.Duration) error

func SetIgnitionFile added in v4.8.0

func SetIgnitionFile(loc *define.VMFile, vmtype VMType, vmName string) error

SetIgnitionFile creates a new Machine File for the machine's ignition file and assignes the handle to `loc`

func SetRootful added in v4.7.0

func SetRootful(rootful bool, name, rootfulName string) error

SetRootful modifies the machine's default connection to be either rootful or rootless

func SetSocket added in v4.8.0

func SetSocket(socketLoc *define.VMFile, path string, symlink *string) error

SetSocket creates a new machine file for the socket and assigns it to `socketLoc`

func StrToPtr added in v4.6.0

func StrToPtr(s string) *string

Convenience function to convert string to ptr

func UpdatePodmanDockerSockService added in v4.6.0

func UpdatePodmanDockerSockService(vm VM, name string, uid int, rootful bool) error

func WaitAPIAndPrintInfo added in v4.7.0

func WaitAPIAndPrintInfo(forwardState APIForwardingState, name, helper, forwardSock string, noInfo, isIncompatible, rootful bool)

WaitAPIAndPrintInfo prints info about the machine and does a ping test on the API socket

func WaitAndPingAPI added in v4.7.0

func WaitAndPingAPI(sock string)

func WriteConfig added in v4.7.0

func WriteConfig(configPath string, v VM) error

WriteConfig writes the machine's JSON config file

Types

type APIForwardingState added in v4.6.0

type APIForwardingState int
const (
	NoForwarding APIForwardingState = iota
	ClaimUnsupported
	NotInstalled
	MachineLocal
	DockerGlobal
)

type CleanupCallback added in v4.8.0

type CleanupCallback struct {
	Funcs []func() error
	// contains filtered or unexported fields
}

func InitCleanup added in v4.8.0

func InitCleanup() CleanupCallback

func (*CleanupCallback) Add added in v4.8.0

func (c *CleanupCallback) Add(anotherfunc func() error)

func (*CleanupCallback) CleanIfErr added in v4.8.0

func (c *CleanupCallback) CleanIfErr(err *error)

func (*CleanupCallback) CleanOnSignal added in v4.8.0

func (c *CleanupCallback) CleanOnSignal()

type Clevis

type Clevis struct {
	Custom    *Custom `json:"custom,omitempty"`
	Tang      []Tang  `json:"tang,omitempty"`
	Threshold *int    `json:"threshold,omitempty"`
	Tpm2      *bool   `json:"tpm2,omitempty"`
}

type Config

type Config struct {
	Ignition Ignition `json:"ignition"`
	Passwd   Passwd   `json:"passwd,omitempty"`
	Storage  Storage  `json:"storage,omitempty"`
	Systemd  Systemd  `json:"systemd,omitempty"`
}

type ConnectionConfig added in v4.2.0

type ConnectionConfig struct {
	// PodmanSocket is the exported podman service socket
	PodmanSocket *define.VMFile `json:"PodmanSocket"`
	// PodmanPipe is the exported podman service named pipe (Windows hosts only)
	PodmanPipe *define.VMFile `json:"PodmanPipe"`
}

ConnectionConfig contains connections like sockets, etc.

type Custom

type Custom struct {
	Config       string `json:"config"`
	NeedsNetwork *bool  `json:"needsNetwork,omitempty"`
	Pin          string `json:"pin"`
}

type Device

type Device string

type Directory

type Directory struct {
	Node
	DirectoryEmbedded1
}

type DirectoryEmbedded1

type DirectoryEmbedded1 struct {
	Mode *int `json:"mode,omitempty"`
}

type Disk

type Disk struct {
	Device     string      `json:"device"`
	Partitions []Partition `json:"partitions,omitempty"`
	WipeTable  *bool       `json:"wipeTable,omitempty"`
}

type DistributionDownload

type DistributionDownload interface {
	HasUsableCache() (bool, error)
	Get() *Download
	CleanCache() error
}

func NewGenericDownloader

func NewGenericDownloader(vmType VMType, vmName, pullPath string) (DistributionDownload, error)

NewGenericDownloader is used when the disk image is provided by the user

type Download

type Download struct {
	Arch                  string
	Artifact              define.Artifact
	CacheDir              string
	CompressionType       compression.ImageCompression
	DataDir               string
	Format                define.ImageFormat
	ImageName             string
	LocalPath             string
	LocalUncompressedFile string
	Sha256sum             string
	Size                  int64
	URL                   *url.URL
	VMKind                VMType
	VMName                string
}

func (Download) AcquireAlternateImage added in v4.7.0

func (dl Download) AcquireAlternateImage(inputPath string) (*define.VMFile, error)

AcquireAlternateImage downloads the alternate image the user provided, which can be a file path or URL

func (Download) AcquireVMImage added in v4.7.0

func (dl Download) AcquireVMImage(imagePath string) (*define.VMFile, FCOSStream, error)

AcquireVMImage determines if the image is already in a FCOS stream. If so, retrieves the image path of the uncompressed file. Otherwise, the user has provided an alternative image, so we set the image path and download the image.

func (Download) GetFCOSDownload added in v4.7.0

func (dl Download) GetFCOSDownload(imageStream FCOSStream) (*FcosDownloadInfo, error)

GetFCOSDownload parses fedoraCoreOS's stream and returns the image download URL and the release version

func (Download) GetLocalUncompressedFile added in v4.5.0

func (dl Download) GetLocalUncompressedFile(dataDir string) string

func (Download) NewFcosDownloader added in v4.7.0

func (dl Download) NewFcosDownloader(imageStream FCOSStream) (DistributionDownload, error)

type Dropin

type Dropin struct {
	Contents *string `json:"contents,omitempty"`
	Name     string  `json:"name"`
}

type DynamicIgnition

type DynamicIgnition struct {
	Name       string
	Key        string
	TimeZone   string
	UID        int
	VMName     string
	VMType     VMType
	WritePath  string
	Cfg        Config
	Rootful    bool
	NetRecover bool
}

func (*DynamicIgnition) GenerateIgnitionConfig added in v4.6.0

func (ign *DynamicIgnition) GenerateIgnitionConfig() error

GenerateIgnitionConfig

func (*DynamicIgnition) Write added in v4.6.0

func (ign *DynamicIgnition) Write() error

type ErrNewDiskSizeTooSmall added in v4.8.0

type ErrNewDiskSizeTooSmall struct {
	OldSize, NewSize strongunits.GiB
}

func (*ErrNewDiskSizeTooSmall) Error added in v4.8.0

func (err *ErrNewDiskSizeTooSmall) Error() string

type ErrVMDoesNotExist added in v4.8.0

type ErrVMDoesNotExist struct {
	Name string
}

func (*ErrVMDoesNotExist) Error added in v4.8.0

func (err *ErrVMDoesNotExist) Error() string

type ErrVMRunningCannotDestroyed added in v4.8.0

type ErrVMRunningCannotDestroyed struct {
	Name string
}

func (*ErrVMRunningCannotDestroyed) Error added in v4.8.0

func (err *ErrVMRunningCannotDestroyed) Error() string

type FCOSStream added in v4.5.0

type FCOSStream int64
const (
	// FCOS streams
	// Testing FCOS stream
	Testing FCOSStream = iota
	// Next FCOS stream
	Next
	// Stable FCOS stream
	Stable
	// Podman-Testing
	PodmanTesting
	// Unknown
	UnknownStream
	// Custom
	CustomStream
)

func FCOSStreamFromString added in v4.5.0

func FCOSStreamFromString(s string) (FCOSStream, error)

func Pull added in v4.8.0

func Pull(input, machineName string, vp VirtProvider) (*define.VMFile, FCOSStream, error)

func (FCOSStream) String added in v4.5.0

func (st FCOSStream) String() string

String is a helper func for fcos streams

type FcosDownload

type FcosDownload struct {
	Download
}

func (FcosDownload) CleanCache added in v4.2.0

func (f FcosDownload) CleanCache() error

func (FcosDownload) Get

func (f FcosDownload) Get() *Download

func (FcosDownload) HasUsableCache

func (f FcosDownload) HasUsableCache() (bool, error)

type FcosDownloadInfo added in v4.1.0

type FcosDownloadInfo struct {
	CompressionType compression.ImageCompression
	Location        string
	Release         string
	Sha256Sum       string
}

type File

type File struct {
	Node
	FileEmbedded1
}

type FileEmbedded1

type FileEmbedded1 struct {
	Append   []Resource `json:"append,omitempty"`
	Contents Resource   `json:"contents,omitempty"`
	Mode     *int       `json:"mode,omitempty"`
}

type Filesystem

type Filesystem struct {
	Device         string             `json:"device"`
	Format         *string            `json:"format,omitempty"`
	Label          *string            `json:"label,omitempty"`
	MountOptions   []MountOption      `json:"mountOptions,omitempty"`
	Options        []FilesystemOption `json:"options,omitempty"`
	Path           *string            `json:"path,omitempty"`
	UUID           *string            `json:"uuid,omitempty"`
	WipeFilesystem *bool              `json:"wipeFilesystem,omitempty"`
}

type FilesystemOption

type FilesystemOption string

type GenericDownload

type GenericDownload struct {
	Download
}

GenericDownload is used when a user provides a URL or path for an image

func (GenericDownload) CleanCache added in v4.2.0

func (g GenericDownload) CleanCache() error

CleanCache cleans out downloaded uncompressed image files

func (GenericDownload) Get

func (g GenericDownload) Get() *Download

func (GenericDownload) HasUsableCache

func (g GenericDownload) HasUsableCache() (bool, error)

type Group

type Group string

type HTTPHeader

type HTTPHeader struct {
	Name  string  `json:"name"`
	Value *string `json:"value,omitempty"`
}

type HTTPHeaders

type HTTPHeaders []HTTPHeader

type HostUser added in v4.1.0

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 Ignition

type Ignition struct {
	Config   IgnitionConfig `json:"config,omitempty"`
	Proxy    Proxy          `json:"proxy,omitempty"`
	Security Security       `json:"security,omitempty"`
	Timeouts Timeouts       `json:"timeouts,omitempty"`
	Version  string         `json:"version,omitempty"`
}

type IgnitionBuilder added in v4.8.0

type IgnitionBuilder struct {
	// contains filtered or unexported fields
}

func NewIgnitionBuilder added in v4.8.0

func NewIgnitionBuilder(dynamicIgnition DynamicIgnition) IgnitionBuilder

NewIgnitionBuilder generates a new IgnitionBuilder type using the base `DynamicIgnition` object

func (*IgnitionBuilder) Build added in v4.8.0

func (i *IgnitionBuilder) Build() error

Build writes the internal `DynamicIgnition` config to its write path

func (*IgnitionBuilder) BuildWithIgnitionFile added in v4.8.0

func (i *IgnitionBuilder) BuildWithIgnitionFile(ignPath string) error

BuildWithIgnitionFile copies the provided ignition file into the internal `DynamicIgnition` write path

func (*IgnitionBuilder) GenerateIgnitionConfig added in v4.8.0

func (i *IgnitionBuilder) GenerateIgnitionConfig() error

GenerateIgnitionConfig generates the ignition config

func (*IgnitionBuilder) WithFile added in v4.8.0

func (i *IgnitionBuilder) WithFile(files ...File)

WithFile adds storage files to the internal `DynamicIgnition` config

func (*IgnitionBuilder) WithUnit added in v4.8.0

func (i *IgnitionBuilder) WithUnit(units ...Unit)

WithUnit adds systemd units to the internal `DynamicIgnition` config

type IgnitionConfig

type IgnitionConfig struct {
	Merge   []Resource `json:"merge,omitempty"`
	Replace Resource   `json:"replace,omitempty"`
}

type ImageConfig added in v4.1.0

type ImageConfig struct {
	// IgnitionFile is the path to the filesystem where the
	// ignition file was written (if needs one)
	IgnitionFile define.VMFile `json:"IgnitionFilePath"`
	// ImageStream is the update stream for the image
	ImageStream string
	// ImageFile is the fq path to
	ImagePath define.VMFile `json:"ImagePath"`
}

ImageConfig describes the bootable image for the VM

type InitOptions

type InitOptions struct {
	CPUS               uint64
	DiskSize           uint64
	IgnitionPath       string
	ImagePath          string
	Volumes            []string
	VolumeDriver       string
	IsDefault          bool
	Memory             uint64
	Name               string
	TimeZone           string
	URI                url.URL
	Username           string
	ReExec             bool
	Rootful            bool
	UID                string // uid of the user that called machine
	UserModeNetworking *bool  // nil = use backend/system default, false = disable, true = enable
	USBs               []string
}

type InspectInfo added in v4.1.0

type InspectInfo struct {
	ConfigPath         define.VMFile
	ConnectionInfo     ConnectionConfig
	Created            time.Time
	Image              ImageConfig
	LastUp             time.Time
	Name               string
	Resources          ResourceConfig
	SSHConfig          SSHConfig
	State              Status
	UserModeNetworking bool
	Rootful            bool
}

type InspectOptions added in v4.1.0

type InspectOptions struct{}
type Link struct {
	Node
	LinkEmbedded1
}

type LinkEmbedded1

type LinkEmbedded1 struct {
	Hard   *bool  `json:"hard,omitempty"`
	Target string `json:"target"`
}

type ListOptions

type ListOptions struct{}

type ListResponse

type ListResponse struct {
	Name               string
	CreatedAt          time.Time
	LastUp             time.Time
	Running            bool
	Starting           bool
	Stream             string
	VMType             string
	CPUs               uint64
	Memory             uint64
	DiskSize           uint64
	Port               int
	RemoteUsername     string
	IdentityPath       string
	UserModeNetworking bool
}

type Luks

type Luks struct {
	Clevis     *Clevis      `json:"clevis,omitempty"`
	Device     *string      `json:"device,omitempty"`
	KeyFile    Resource     `json:"keyFile,omitempty"`
	Label      *string      `json:"label,omitempty"`
	Name       string       `json:"name"`
	Options    []LuksOption `json:"options,omitempty"`
	UUID       *string      `json:"uuid,omitempty"`
	WipeVolume *bool        `json:"wipeVolume,omitempty"`
}

type LuksOption

type LuksOption string

type Mount added in v4.1.0

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

type MountOption

type MountOption string

type NoProxyItem

type NoProxyItem string

type Node

type Node struct {
	Group     NodeGroup `json:"group,omitempty"`
	Overwrite *bool     `json:"overwrite,omitempty"`
	Path      string    `json:"path"`
	User      NodeUser  `json:"user,omitempty"`
}

type NodeGroup

type NodeGroup struct {
	ID   *int    `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

func GetNodeGrp added in v4.6.0

func GetNodeGrp(grpName string) NodeGroup

type NodeUser

type NodeUser struct {
	ID   *int    `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

func GetNodeUsr added in v4.6.0

func GetNodeUsr(usrName string) NodeUser

type Partition

type Partition struct {
	GUID               *string `json:"guid,omitempty"`
	Label              *string `json:"label,omitempty"`
	Number             int     `json:"number,omitempty"`
	Resize             *bool   `json:"resize,omitempty"`
	ShouldExist        *bool   `json:"shouldExist,omitempty"`
	SizeMiB            *int    `json:"sizeMiB,omitempty"`
	StartMiB           *int    `json:"startMiB,omitempty"`
	TypeGUID           *string `json:"typeGuid,omitempty"`
	WipePartitionEntry *bool   `json:"wipePartitionEntry,omitempty"`
}

type Passwd

type Passwd struct {
	Groups []PasswdGroup `json:"groups,omitempty"`
	Users  []PasswdUser  `json:"users,omitempty"`
}

type PasswdGroup

type PasswdGroup struct {
	Gid          *int    `json:"gid,omitempty"`
	Name         string  `json:"name"`
	PasswordHash *string `json:"passwordHash,omitempty"`
	ShouldExist  *bool   `json:"shouldExist,omitempty"`
	System       *bool   `json:"system,omitempty"`
}

type PasswdUser

type PasswdUser struct {
	Gecos             *string            `json:"gecos,omitempty"`
	Groups            []Group            `json:"groups,omitempty"`
	HomeDir           *string            `json:"homeDir,omitempty"`
	Name              string             `json:"name"`
	NoCreateHome      *bool              `json:"noCreateHome,omitempty"`
	NoLogInit         *bool              `json:"noLogInit,omitempty"`
	NoUserGroup       *bool              `json:"noUserGroup,omitempty"`
	PasswordHash      *string            `json:"passwordHash,omitempty"`
	PrimaryGroup      *string            `json:"primaryGroup,omitempty"`
	SSHAuthorizedKeys []SSHAuthorizedKey `json:"sshAuthorizedKeys,omitempty"`
	Shell             *string            `json:"shell,omitempty"`
	ShouldExist       *bool              `json:"shouldExist,omitempty"`
	System            *bool              `json:"system,omitempty"`
	UID               *int               `json:"uid,omitempty"`
}

type Proxy

type Proxy struct {
	HTTPProxy  *string       `json:"httpProxy,omitempty"`
	HTTPSProxy *string       `json:"httpsProxy,omitempty"`
	NoProxy    []NoProxyItem `json:"noProxy,omitempty"`
}

type Raid

type Raid struct {
	Devices []Device     `json:"devices"`
	Level   string       `json:"level"`
	Name    string       `json:"name"`
	Options []RaidOption `json:"options,omitempty"`
	Spares  *int         `json:"spares,omitempty"`
}

type RaidOption

type RaidOption string

type RemoteConnectionType

type RemoteConnectionType string

func (RemoteConnectionType) MakeSSHURL

func (rc RemoteConnectionType) MakeSSHURL(host, path, port, userName string) url.URL

type RemoveOptions

type RemoveOptions struct {
	Force        bool
	SaveKeys     bool
	SaveImage    bool
	SaveIgnition bool
}

type Resource

type Resource struct {
	Compression  *string      `json:"compression,omitempty"`
	HTTPHeaders  HTTPHeaders  `json:"httpHeaders,omitempty"`
	Source       *string      `json:"source,omitempty"`
	Verification Verification `json:"verification,omitempty"`
}

type ResourceConfig added in v4.1.0

type ResourceConfig struct {
	// CPUs to be assigned to the VM
	CPUs uint64
	// Disk size in gigabytes assigned to the vm
	DiskSize uint64
	// Memory in megabytes assigned to the vm
	Memory uint64
	// Usbs
	USBs []USBConfig
}

ResourceConfig describes physical attributes of the machine

type SSHAuthorizedKey

type SSHAuthorizedKey string

type SSHConfig added in v4.1.0

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 SSHOptions

type SSHOptions struct {
	Username string
	Args     []string
}

type Security

type Security struct {
	TLS TLS `json:"tls,omitempty"`
}

type SetOptions

type SetOptions struct {
	CPUs               *uint64
	DiskSize           *uint64
	Memory             *uint64
	Rootful            *bool
	UserModeNetworking *bool
	USBs               *[]string
}

type StartOptions

type StartOptions struct {
	NoInfo bool
	Quiet  bool
}

type Status added in v4.1.0

type Status = string

type StopOptions

type StopOptions struct{}

type Storage

type Storage struct {
	Directories []Directory  `json:"directories,omitempty"`
	Disks       []Disk       `json:"disks,omitempty"`
	Files       []File       `json:"files,omitempty"`
	Filesystems []Filesystem `json:"filesystems,omitempty"`
	Links       []Link       `json:"links,omitempty"`
	Luks        []Luks       `json:"luks,omitempty"`
	Raid        []Raid       `json:"raid,omitempty"`
}

type Systemd

type Systemd struct {
	Units []Unit `json:"units,omitempty"`
}

type TLS

type TLS struct {
	CertificateAuthorities []Resource `json:"certificateAuthorities,omitempty"`
}

type Tang

type Tang struct {
	Thumbprint *string `json:"thumbprint,omitempty"`
	URL        string  `json:"url,omitempty"`
}

type Timeouts

type Timeouts struct {
	HTTPResponseHeaders *int `json:"httpResponseHeaders,omitempty"`
	HTTPTotal           *int `json:"httpTotal,omitempty"`
}

type USBConfig added in v4.8.0

type USBConfig struct {
	Bus       string
	DevNumber string
	Vendor    int
	Product   int
}

type Unit

type Unit struct {
	Contents *string  `json:"contents,omitempty"`
	Dropins  []Dropin `json:"dropins,omitempty"`
	Enabled  *bool    `json:"enabled,omitempty"`
	Mask     *bool    `json:"mask,omitempty"`
	Name     string   `json:"name"`
}

type VM

type VM interface {
	Init(opts InitOptions) (bool, error)
	Inspect() (*InspectInfo, error)
	Remove(name string, opts RemoveOptions) (string, func() error, error)
	Set(name string, opts SetOptions) ([]error, error)
	SSH(name string, opts SSHOptions) error
	Start(name string, opts StartOptions) error
	State(bypass bool) (Status, error)
	Stop(name string, opts StopOptions) error
}

type VMType added in v4.5.0

type VMType int64
const (
	QemuVirt VMType = iota
	WSLVirt
	AppleHvVirt
	HyperVVirt
	UnknownVirt
)

func ParseVMType added in v4.6.0

func ParseVMType(input string, emptyFallback VMType) (VMType, error)

func (VMType) String added in v4.5.0

func (v VMType) String() string

type Verification

type Verification struct {
	Hash *string `json:"hash,omitempty"`
}

type VirtIoFs added in v4.7.0

type VirtIoFs struct {
	VolumeKind
	ReadOnly bool
	Source   string
	Tag      string
	Target   string
}

func NewVirtIoFsMount added in v4.7.0

func NewVirtIoFsMount(src, target string, readOnly bool) VirtIoFs

NewVirtIoFsMount describes a machine volume mount for virtio-fs. With virtio-fs the source/target are described as a "shared dir". With this style of volume mount the Tag is used as the descriptor value for the mount (in Linux).

func (VirtIoFs) Kind added in v4.7.0

func (v VirtIoFs) Kind() string

func (VirtIoFs) ToMount added in v4.7.0

func (v VirtIoFs) ToMount() Mount

type VirtProvider added in v4.5.0

type VirtProvider interface {
	Artifact() define.Artifact
	CheckExclusiveActiveVM() (bool, string, error)
	Compression() compression.ImageCompression
	Format() define.ImageFormat
	IsValidVMName(name string) (bool, error)
	List(opts ListOptions) ([]*ListResponse, error)
	LoadVMByName(name string) (VM, error)
	NewMachine(opts InitOptions) (VM, error)
	NewDownload(vmName string) (Download, error)
	RemoveAndCleanMachines() error
	VMType() VMType
}

type Virtualization added in v4.7.0

type Virtualization struct {
	// contains filtered or unexported fields
}

func NewVirtualization added in v4.7.0

func NewVirtualization(artifact define.Artifact, compression compression.ImageCompression, format define.ImageFormat, vmKind VMType) Virtualization

func (*Virtualization) Artifact added in v4.7.0

func (p *Virtualization) Artifact() define.Artifact

func (*Virtualization) Compression added in v4.7.0

func (p *Virtualization) Compression() compression.ImageCompression

func (*Virtualization) Format added in v4.7.0

func (p *Virtualization) Format() define.ImageFormat

func (*Virtualization) NewDownload added in v4.7.0

func (p *Virtualization) NewDownload(vmName string) (Download, error)

func (*Virtualization) VMType added in v4.7.0

func (p *Virtualization) VMType() VMType

type Volume added in v4.7.0

type Volume interface {
	Kind() VolumeKind
}

type VolumeKind added in v4.7.0

type VolumeKind string
var (
	VirtIOFsVk VolumeKind = "virtiofs"
	NinePVk    VolumeKind = "9p"
)

Directories

Path Synopsis
wsl

Jump to

Keyboard shortcuts

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