machine

package
v5.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 31 Imported by: 4

Documentation

Index

Constants

View Source
const NFSSELinuxContext = "system_u:object_r:nfs_t:s0"

NFSSELinuxContext is what is used by NFS mounts, which is allowed access by container_t. We need to fix the Fedora selinux policy to just allow access to virtiofs_t.

Variables

View Source
var ForwarderBinaryName = "gvproxy"

Functions

func CleanupGVProxy

func CleanupGVProxy(f define.VMFile) error

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

func CreateSSHKeys

func CreateSSHKeys(writeLocation string) (string, error)

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

func DialNamedPipe

func DialNamedPipe(ctx context.Context, path string) (net.Conn, error)

func GetDevNullFiles

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

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

func GetEnvSetString

func GetEnvSetString(env string, val string) string

func GetSSHKeys

func GetSSHKeys(identityPath string) (string, error)

GetSSHKeys checks to see if there is a ssh key at the provided location. If not, we create the priv and pub keys. The ssh key is then returned.

func LocalhostSSH added in v5.6.0

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

LocalhostSSH is a common function for ssh'ing to a podman machine using system-connections and a port TODO This should probably be taught about an machineconfig to reduce input

func LocalhostSSHArgs added in v5.6.0

func LocalhostSSHArgs() []string

LocalhostSSHArgs returns OpenSSH command-line options for connecting with no host key identity checks.

WARNING: This MUST NOT be used to communicate over untrusted networks.

func LocalhostSSHShell added in v5.6.0

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

func LocalhostSSHSilent added in v5.6.0

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

func LocalhostSSHWithStdin added in v5.6.0

func LocalhostSSHWithStdin(username, identityPath, name string, sshPort int, inputArgs []string, stdin io.Reader) error

func PrintRootlessWarning

func PrintRootlessWarning(name string)

func UpdatePodmanDockerSockService

func UpdatePodmanDockerSockService(mc *vmconfigs.MachineConfig) error

func WaitAPIAndPrintInfo

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

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

func WaitAndPingAPI

func WaitAndPingAPI(sock string)

Types

type APIForwardingState

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

type CleanupCallback

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

func CleanUp

func CleanUp() CleanupCallback

func (*CleanupCallback) Add

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

func (*CleanupCallback) CleanIfErr

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

func (*CleanupCallback) CleanOnSignal

func (c *CleanupCallback) CleanOnSignal()

type ConnectionConfig

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 DistributionDownload

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

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                define.VMType
	VMName                string
}

type ImageConfig

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 InspectInfo

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

type InspectOptions

type InspectOptions struct{}

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             strongunits.MiB
	Swap               strongunits.MiB
	DiskSize           strongunits.GiB
	Port               int
	RemoteUsername     string
	IdentityPath       string
	UserModeNetworking bool
}

type RemoveOptions

type RemoveOptions struct {
	Force        bool
	SaveImage    bool
	SaveIgnition bool
}

type ResetOptions

type ResetOptions struct {
	Force bool
}

type SSHOptions

type SSHOptions struct {
	Username string
	Args     []string
}

type StartOptions

type StartOptions struct {
	NoInfo  bool
	Quiet   bool
	Rosetta bool
}

type StopOptions

type StopOptions struct{}

type VM

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

TODO This can be removed when WSL is refactored into podman 5

type VirtIoFs

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

func MountToVirtIOFs

func MountToVirtIOFs(mnt *vmconfigs.Mount) VirtIoFs

func NewVirtIoFsMount

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

func (v VirtIoFs) Kind() string

func (VirtIoFs) ToMount

func (v VirtIoFs) ToMount() vmconfigs.Mount

type Volume

type Volume interface {
	Kind() VolumeKind
}

type VolumeKind

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

Jump to

Keyboard shortcuts

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