Documentation ¶
Overview ¶
Package vm contains utility functions used in integ tests with qemu VMs.
Index ¶
- Variables
- func AddDevs(devs ...qemu.Device) func(o *qemu.Options) error
- func CheckForbidden(t gtst.TB, lsrv rlog.MockSrvr, uefi bool, strs []string)
- func CheckFormattingErrs(t gtst.TB, lsrv rlog.MockSrvr, uefi bool)
- func CopyOutput(t *testing.T) (*bytes.Buffer, io.WriteCloser)
- func CreateQcow(path string, siz uint64) error
- func DisableLDD(u *uroot.Opts) error
- func Find9p(t gtst.TB, tmpdir, glob string) []byte
- func MultiNet(opts *vmtest.Options, n int)
- func NopCloserW(w io.Writer) io.WriteCloser
- func Ram(i int) qemu.Device
- func Ram5120(o *qemu.Options) error
- func Rawpath(tmpdir string, uefi bool) string
- func RequireRE(t gtst.TB, vm *qemu.VM, reLines ...string)
- func RequireTxt(t gtst.TB, vm *qemu.VM, lines ...string)
- func RequireTxt9p(t gtst.TB, p9log []byte, items ...string)
- func SerNum(uefi bool) string
- func Wait(t gtst.TB, vm *qemu.VM, dly time.Duration)
- type ArbitraryKArgs
- type Attachment
- type BlockDev
- type Bmc
- type Mockinfra
- type NoReboot
- type OUINic
- type SmBios
- type TmplData
- type UefiFw
- type UsbPassthrough
Constants ¶
This section is empty.
Variables ¶
var LogAddrFmt string = "10.0.2.2:%d"
default remotelog addr format, for pblog
Functions ¶
func CheckFormattingErrs ¶
Look for indications of extra or wrong formatting verbs or args to printf and friends
%!d(string=there) %!(EXTRA <nil>) %!s(MISSING) etc
func CopyOutput ¶
Returns a buffer and a WriteCloser. Data written to wc is written to t and copied to buf. Must use testing.T because TestLineWriter requires that.
func CreateQcow ¶
Create qcow-formatted file at path, with given size in bytes.
func DisableLDD ¶
func Find9p ¶
returns content of a file written by an integ test via 9p typically used in call(s) to RequireTxt9p()
func MultiNet ¶
Adds N adapters, all on a new vm-only network. Only useful if you need multiple NICs to show up - not able to communicate with the outside world.
func NopCloserW ¶
func NopCloserW(w io.Writer) io.WriteCloser
func RequireTxt ¶
wait for vm to produce lines matching given lines of plaintext
func RequireTxt9p ¶
look for items in a []byte, typically file content found by Find9p
Types ¶
type ArbitraryKArgs ¶
type ArbitraryKArgs []string
func (ArbitraryKArgs) Cmdline ¶
func (a ArbitraryKArgs) Cmdline() []string
func (ArbitraryKArgs) KArgs ¶
func (a ArbitraryKArgs) KArgs() []string
type Attachment ¶
type Attachment int
const ( UnknownAttach Attachment = iota UsbAttach //usb2 UsbXhciAttach //usb3. shows as usb device (necessary for recovery), but faster. IdeAttach //called 'ide-hd' but looks like sata in vm )
type BlockDev ¶
type BlockDev struct { // attachment method - usb, usb3, ide, ... Attachment Attachment // size _in bytes_ Size uint64 // number of drives, must be > 0 Count int // optional model. known to work with ide. Model string // filename prefix, to which an (optional) index and extn are added // index is only used when Count > 1 and dev # > 1 // e.g. /abs/path/to/block.qcow, /abs/path/to/block2.qcow, /abs/path/to/block3.qcow, ... // // if empty, prefix is generated, MustExist must be false. // // if value is "null", indicates qemu should use the null-copy back end // which reports the desired size, but reads as zeros and discards writes. FilePfx string // if true, file(s) must already exist. if false, will use found files or create new. MustExist bool // Used for file location if FilePfx is empty; a dir is created if this is empty TmpDir string // If non-zero, appended to the device to influence boot order. // Implies no '-kernel'. used for recovery. BootIndex uint64 // Arbitrary string that can be used to identify devices in code later on. // Not passed to qemu. Id string }
func (*BlockDev) UniqueId ¶
Derives a unique sequence from the bd pointer's value. Something unique is needed to differentiate between devices, and this suffices. Encoded to increase the effective bits-per-byte. Must be safe for use as a file name or qemu device id, so we encode Base32 rather than Base64 etc.
type Mockinfra ¶
type Mockinfra struct { LSrvr rlog.MockSrvr MfgUrl string BootKernelPath string TmplData TmplData // contains filtered or unexported fields }
data used to populate manufData json and to serve other files used by mfg
type TmplData ¶
type TmplData struct {
Mem, CPUs int
FPort int
CredEP string
LAddr string
KName, StashName string
CmdSum string
StashSum, UpdSum, KSum string
UpdName string
}
data that is available to template
type UsbPassthrough ¶
type UsbPassthrough struct {
Hostbus, Hostport string
}
func (*UsbPassthrough) Cmdline ¶
func (up *UsbPassthrough) Cmdline() []string
func (*UsbPassthrough) KArgs ¶
func (up *UsbPassthrough) KArgs() []string