fakemachine: github.com/go-debos/fakemachine Index | Files | Directories

package fakemachine

import "github.com/go-debos/fakemachine"

Index

Package Files

machine.go

func InMachine Uses

func InMachine() (ret bool)

func Supported Uses

func Supported() bool

type Machine Uses

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

func NewMachine Uses

func NewMachine() (m *Machine)

Create a new machine object

func (*Machine) AddVolume Uses

func (m *Machine) AddVolume(directory string)

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

func (*Machine) AddVolumeAt Uses

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

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

func (*Machine) CreateImage Uses

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 Uses

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 Uses

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

Run creates the machine running the given command

func (*Machine) RunInMachine Uses

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 Uses

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

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

func (*Machine) SetEnviron Uses

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

func (*Machine) SetMemory Uses

func (m *Machine) SetMemory(memory int)

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

func (*Machine) SetNumCPUs Uses

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 Uses

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 Uses

func (m *Machine) SetShowBoot(showBoot bool)

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

Directories

PathSynopsis
cpio

Package fakemachine imports 12 packages (graph) and is imported by 5 packages. Updated 2020-06-05. Refresh now. Tools for package owners.