vm

package
v0.0.0-...-0d5b41c Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Passive     = "passive"
	Active      = "active"
	Recovery    = "recovery"
	LiveCD      = "liveCD"
	UnknownBoot = "unknown"

	TimeoutRawDiskTest = 600 // Timeout to connect for recovery_raw_disk_test

	Ext2 = "ext2"
	Ext3 = "ext3"
	Ext4 = "ext4"
	Cos  = "cos"
)

Variables

This section is empty.

Functions

func SSHDialTimeout

func SSHDialTimeout(network, addr string, config *ssh.ClientConfig, timeout time.Duration) (*ssh.Client, error)

func SystemdUnitIsActive

func SystemdUnitIsActive(s string, st *SUT)

func SystemdUnitIsStarted

func SystemdUnitIsStarted(s string, st *SUT)

Types

type Conn

type Conn struct {
	net.Conn
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type DiskLayout

type DiskLayout struct {
	BlockDevices []PartitionEntry `json:"blockdevices"`
}

DiskLayout is the struct that contains the disk output from lsblk

func (DiskLayout) GetPartition

func (d DiskLayout) GetPartition(label string) (PartitionEntry, error)

type PartitionEntry

type PartitionEntry struct {
	Label  string `json:"label,omitempty"`
	Size   int    `json:"size,omitempty"`
	FsType string `json:"fstype,omitempty"`
}

PartitionEntry represents a partition entry

type SUT

type SUT struct {
	Host     string
	Username string
	Password string
	Timeout  int

	TestVersion string
	CDLocation  string
	MachineID   string
	VMPid       int
	// contains filtered or unexported fields
}

func NewSUT

func NewSUT() *SUT

func (SUT) AssertBootedFrom

func (s SUT) AssertBootedFrom(b string)

AssertBootedFrom asserts that we booted from the proper type and adds a helpful message

func (*SUT) BootFrom

func (s *SUT) BootFrom() string

BootFrom returns the booting partition of the SUT

func (*SUT) ChangeBoot

func (s *SUT) ChangeBoot(b string) error

func (*SUT) ChangeBootOnce

func (s *SUT) ChangeBootOnce(b string) error

func (*SUT) Command

func (s *SUT) Command(cmd string) (string, error)

Command sends a command to the SUIT and waits for reply

func (*SUT) EjectCD

func (s *SUT) EjectCD()

EjectCD force removes the DVD so we can boot from disk directly on EFI VMs

func (SUT) ElementalCmd

func (s SUT) ElementalCmd(args ...string) string

ElementalCmd will run the default elemental binary with some default flags useful for testing and the given args it allows overriding the default args just in case

func (*SUT) EmptyDisk

func (s *SUT) EmptyDisk(disk string)

EmptyDisk will try to trash the disk given so on reboot the disk is empty and we are forced to use the cd to boot used mainly for installer testing booting from iso

func (*SUT) EventuallyConnects

func (s *SUT) EventuallyConnects(t ...int)

func (SUT) GatherAllLogs

func (s SUT) GatherAllLogs()

GatherAllLogs will try to gather as much info from the system as possible, including services, dmesg and os related info

func (SUT) GatherLog

func (s SUT) GatherLog(logPath string)

GatherLog will try to scp the given log from the machine to a local file

func (*SUT) GetArch

func (s *SUT) GetArch() string

func (SUT) GetDiskLayout

func (s SUT) GetDiskLayout(disk string) DiskLayout

func (*SUT) GetOSRelease

func (s *SUT) GetOSRelease(ss string) string

func (*SUT) IsVMRunning

func (s *SUT) IsVMRunning() bool

func (*SUT) PowerOff

func (s *SUT) PowerOff()

func (*SUT) Reboot

func (s *SUT) Reboot(t ...int)

Reboot reboots the system under test

func (*SUT) Reset

func (s *SUT) Reset()

Reset runs reboots cOS into Recovery and runs elemental reset. It will boot back the system from the Active partition afterwards

func (*SUT) RestoreCD

func (s *SUT) RestoreCD()

RestoreCD reattaches the previously mounted iso to the VM

func (*SUT) RestoreSnapshot

func (s *SUT) RestoreSnapshot() error

func (*SUT) SendFile

func (s *SUT) SendFile(src, dst, permission string) error

func (*SUT) SetCDLocation

func (s *SUT) SetCDLocation()

SetCDLocation gets the location of the iso attached to the vbox vm and stores it for later remount

func (*SUT) Snapshot

func (s *SUT) Snapshot() error

func (*SUT) Start

func (s *SUT) Start()

Jump to

Keyboard shortcuts

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