vm

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrVMInUse = errors.New("VM already in use")

Functions

func GetVMCachePath

func GetVMCachePath(imageId string, user user.User) (longID string, path string, err error)

GetVMCachePath returns the path to the VM cache directory

func StartMonitor

func StartMonitor(ctx context.Context, params MonitorParmeters) error

Types

type BootcVM

type BootcVM interface {
	Run(RunVMParameters) error
	Delete() error
	IsRunning() (bool, error)
	WriteConfig(bootc.BootcDisk) error
	WaitForSSHToBeReady() error
	RunSSH([]string) error
	DeleteFromCache() error
	CacheDir() string
	Exists() (bool, error)
	GetConfig() (*BootcVMConfig, error)
	CloseConnection()
	PrintConsole() error
	Unlock() error
}

type BootcVMCommon

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

func (*BootcVMCommon) CacheDir

func (v *BootcVMCommon) CacheDir() string

func (*BootcVMCommon) DeleteFromCache

func (v *BootcVMCommon) DeleteFromCache() error

Delete removes the VM disk image and the VM configuration from the podman-bootc cache

func (*BootcVMCommon) LoadConfigFile

func (v *BootcVMCommon) LoadConfigFile() (cfg *BootcVMConfig, err error)

func (*BootcVMCommon) ParseCloudInit

func (b *BootcVMCommon) ParseCloudInit() (err error)

func (*BootcVMCommon) RunSSH

func (v *BootcVMCommon) RunSSH(inputArgs []string) error

RunSSH runs a command over ssh or starts an interactive ssh connection if no command is provided

func (*BootcVMCommon) SetUser

func (v *BootcVMCommon) SetUser(user string) error

func (*BootcVMCommon) WaitForSSHToBeReady

func (v *BootcVMCommon) WaitForSSHToBeReady() error

func (*BootcVMCommon) WriteConfig

func (v *BootcVMCommon) WriteConfig(bootcDisk bootc.BootcDisk) error

writeConfig writes the configuration for the VM to the disk

type BootcVMConfig

type BootcVMConfig struct {
	Id          string `json:"Id,omitempty"`
	SshPort     int    `json:"SshPort"`
	SshIdentity string `json:"SshPriKey"`
	RepoTag     string `json:"Repository"`
	Created     string `json:"Created,omitempty"`
	DiskSize    string `json:"DiskSize,omitempty"`
	Running     bool   `json:"Running,omitempty"`
}

type BootcVMLinux

type BootcVMLinux struct {
	BootcVMCommon
	// contains filtered or unexported fields
}

func NewVM

func NewVM(params NewVMParameters) (vm *BootcVMLinux, err error)

func (*BootcVMLinux) CloseConnection

func (v *BootcVMLinux) CloseConnection()

func (*BootcVMLinux) Delete

func (v *BootcVMLinux) Delete() (err error)

Delete the VM definition

func (*BootcVMLinux) Exists

func (v *BootcVMLinux) Exists() (bool, error)

func (*BootcVMLinux) GetConfig

func (v *BootcVMLinux) GetConfig() (cfg *BootcVMConfig, err error)

func (*BootcVMLinux) IsRunning

func (v *BootcVMLinux) IsRunning() (exists bool, err error)

func (*BootcVMLinux) PrintConsole

func (v *BootcVMLinux) PrintConsole() (err error)

func (*BootcVMLinux) Run

func (v *BootcVMLinux) Run(params RunVMParameters) (err error)

func (*BootcVMLinux) Shutdown

func (v *BootcVMLinux) Shutdown() (err error)

Shutdown the VM

func (*BootcVMLinux) Unlock

func (v *BootcVMLinux) Unlock() error

type MonitorParmeters

type MonitorParmeters struct {
	CacheDir    string
	RunDir      string
	Username    string
	SshIdentity string
	SshPort     int
}

type NewVMParameters

type NewVMParameters struct {
	ImageID    string
	User       user.User //user who is running the podman bootc command
	LibvirtUri string    //linux only
	Locking    utils.AccessMode
}

type RunVMParameters

type RunVMParameters struct {
	VMUser        string //user to use when connecting to the VM
	CloudInitDir  string
	CloudInitData bool
	SSHIdentity   string
	SSHPort       int
	Cmd           []string
	RemoveVm      bool
	Background    bool
}

type Vmm

type Vmm int

Jump to

Keyboard shortcuts

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