machine

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: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SSHRemoteConnection     RemoteConnectionType = "ssh"
	DefaultIgnitionUserName                      = "core"
	ErrNoSuchVM                                  = errors.New("VM does not exist")
	ErrVMAlreadyExists                           = errors.New("VM already exists")
	ErrVMAlreadyRunning                          = errors.New("VM already running")
	ErrMultipleActiveVM                          = errors.New("only one VM can be active at a time")
	ForwarderBinaryName                          = "gvproxy"
)
View Source
var (
	Format string = "qcow2.xz"
)

These should eventually be moved into machine/qemu as they are specific to running qemu

Functions

func AddConnection

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

func CreateSSHKeys

func CreateSSHKeys(writeLocation string) (string, error)

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

func Decompress

func Decompress(localPath, uncompressedPath string) error

func DownloadVMImage

func DownloadVMImage(downloadURL fmt.Stringer, localImagePath string) error

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

func GetConfDir

func GetConfDir(vmType string) (string, error)

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

func GetDataDir

func GetDataDir(vmType string) (string, error)

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

func NewIgnitionFile

func NewIgnitionFile(ign DynamicIgnition) error

NewIgnitionFile

func RemoveConnection

func RemoveConnection(name string) error

func UpdateAvailable

func UpdateAvailable(d *Download) (bool, error)

Types

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 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 {
	DownloadImage() error
	Get() *Download
}

func NewFcosDownloader

func NewFcosDownloader(vmType, vmName, imageStream string) (DistributionDownload, error)

func NewGenericDownloader

func NewGenericDownloader(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              string
	CompressionType       string
	Format                string
	ImageName             string `json:"image_name"`
	LocalPath             string
	LocalUncompressedFile string
	Sha256sum             string
	URL                   *url.URL
	VMName                string
}

type Dropin

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

type DynamicIgnition

type DynamicIgnition struct {
	Name      string
	Key       string
	VMName    string
	WritePath string
}

type FcosDownload

type FcosDownload struct {
	Download
}

func (FcosDownload) DownloadImage

func (f FcosDownload) DownloadImage() error

func (FcosDownload) Get

func (f FcosDownload) Get() *Download

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

func (g GenericDownload) DownloadImage() error

func (GenericDownload) Get

func (g GenericDownload) Get() *Download

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

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

type InitOptions

type InitOptions struct {
	CPUS         uint64
	DiskSize     uint64
	IgnitionPath string
	ImagePath    string
	IsDefault    bool
	Memory       uint64
	Name         string
	URI          url.URL
	Username     string
}
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
	Stream    string
	VMType    string
	CPUs      uint64
	Memory    uint64
	DiskSize  uint64
}

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 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"`
}

type NodeUser

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

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 SSHAuthorizedKey

type SSHAuthorizedKey string

type SSHOptions

type SSHOptions struct {
	Username string
	Args     []string
}

type Security

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

type StartOptions

type StartOptions struct{}

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 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) error
	Remove(name string, opts RemoveOptions) (string, func() error, error)
	SSH(name string, opts SSHOptions) error
	Start(name string, opts StartOptions) error
	Stop(name string, opts StopOptions) error
}

type Verification

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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