Documentation ¶
Overview ¶
Package qemu provides an implementation of a Driver driver for job execution. This driver uses the SSH driver to achieve job execution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExpectedArch ¶
func GetExpectedArch() string
GetExpectedArch returns the QEMU arch that would be expected for the GOARCH.
func Init ¶
Init initializes a new driver for QEMU using the given io.Writer, and applying the given driver.Config.
func MatchesGOARCH ¶
MatchesGOARCH checks to see if the given QEMU arch matches the GOARCH. This is used by the worker to make sure that virtualization with KVM would be possible on the platform the worker is being run on.
Types ¶
type Config ¶
type Config struct { Arch string // The architecture to use for virtualization. CPUs int64 // The number of CPUs for the virtual machine. Memory int64 // The amount of memory in bytes for the virtual machine. Disks string // The location to look for disk images. Image string // The QCOW2 image to boot the virtual machine with. }
Config is the struct used for initializing a new QEMU driver for build execution.
type Driver ¶
type Driver struct { io.Writer Arch string // Arch is the machine architecture that will be running the jobs. CPUs int64 // CPUs specifies the number of CPUs to give the machine. Memory int64 // Memory specifies the amount of memory in bytes for the machine. Image string // Image is the name of the QEMU image to use for the machine. // Realpath is a function callback that will return the full path of the // QCOW2 image to use when booting the Driver machine. Realpath realpathFunc // contains filtered or unexported fields }
Driver provides an implementation of the runner.Driver interface for running jobs within a QEMU virtual machine. Under the hood this makes use of the ssh.Driver implementation to communicate with the virtual machine.
func (*Driver) Create ¶
func (q *Driver) Create(c context.Context, env []string, objs runner.Passthrough, p runner.Placer) error
Create will boot a new Driver machine based on the configuration given via a previous call to Init. The Driver process will forward ports from the host to the guest to allow for SSH comms. The host port will be 2222, unless already taken in which case it will increment until all TCP ports have been exhausted.