fakemachine

package module
v0.0.0-...-05f83ee Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackendNames

func BackendNames() []string

A list of backends which are implemented

func InMachine

func InMachine() (ret bool)

func Supported

func Supported() bool

Check whether the auto backend is supported

Types

type Machine

type Machine struct {
	Environ []string
	// contains filtered or unexported fields
}

func NewMachine

func NewMachine() *Machine

Create a new machine object with the auto backend

func NewMachineWithBackend

func NewMachineWithBackend(backendName string) (*Machine, error)

Create a new machine object

func (*Machine) AddVolume

func (m *Machine) AddVolume(directory string)

AddVolume mounts directory from the host at the same location in the fake machine

func (*Machine) AddVolumeAt

func (m *Machine) AddVolumeAt(hostDirectory, machineDirectory string)

AddVolumeAt mounts hostDirectory from the host at machineDirectory in the fake machine

func (*Machine) CreateImage

func (m *Machine) CreateImage(imagepath string, size int64) (string, error)

CreateImage does the same as CreateImageWithLabel but lets the library pick the label.

func (*Machine) CreateImageWithLabel

func (m *Machine) CreateImageWithLabel(path string, size int64, label string) (string,
	error)

CreateImageWithLabel creates an image file at path a given size and exposes it in the fake machine using the given label as the serial id. If size is -1 then the image should already exist and the size isn't modified.

label needs to be less then 20 characters due to limitations from qemu

The returned string is the device path of the new image as seen inside fakemachine.

func (*Machine) Run

func (m *Machine) Run(command string) (int, error)

Run creates the machine running the given command

func (*Machine) RunInMachine

func (m *Machine) RunInMachine() (int, error)

RunInMachine runs the caller binary inside the fakemachine with the same commandline arguments as the parent

func (*Machine) RunInMachineWithArgs

func (m *Machine) RunInMachineWithArgs(args []string) (int, error)

RunInMachineWithArgs runs the caller binary inside the fakemachine with the specified commandline arguments

func (*Machine) SetEnviron

func (m *Machine) SetEnviron(environ []string)

func (*Machine) SetMemory

func (m *Machine) SetMemory(memory int)

SetMemory sets the fakemachines amount of memory (in megabytes). Defaults to 2048 MB

func (*Machine) SetNumCPUs

func (m *Machine) SetNumCPUs(numcpus int)

SetNumCPUs sets the number of CPUs exposed to the fakemachine. Defaults to the number of available cores in the system.

func (*Machine) SetScratch

func (m *Machine) SetScratch(scratchsize int64, path string)

SetScratch sets the size and location of on-disk scratch space to allocate (sparsely) for /scratch. If not set /scratch will be backed by memory. If Path is "" then the working directory is used as a default storage location

func (*Machine) SetShowBoot

func (m *Machine) SetShowBoot(showBoot bool)

SetShowBoot sets whether to show boot/console messages from the fakemachine.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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