taskcluster-worker: github.com/taskcluster/taskcluster-worker/engines/qemu/network Index | Files

package network

import "github.com/taskcluster/taskcluster-worker/engines/qemu/network"

Package network contains scripts and abstractions for setting up TAP-device based networks for a set of QEMU virtual machines.

Each virtual machine will get a TAP device, represented as a network, the TAP device will automatically get an IP address and DNS server using DHCP. The DNS server will resolve the "taskcluster" domains to the meta-data IP address. Request to the meta-data IP will be forwarded to the handler registered for the network instance.

This package uses iptables to lock down network and ensure that the virtual machine attached to a TAP device can't contact the meta-data handler of another virtual machine.

Index

Package Files

doc.go errors.go iptables.go pool.go script.go tap.go usernetwork.go

Variables

var ErrAllNetworksInUse = errors.New("All networks in the network.Pool are in use")

ErrAllNetworksInUse is used to signal that we don't have any more networks available and, thus, can't return one.

type Network Uses

type Network struct {
    // contains filtered or unexported fields
}

Network is provides the interface for using a TAP device, and releasing it.

func (*Network) NetDev Uses

func (n *Network) NetDev(ID string) string

NetDev returns the argument for the QEMU -netdev option.

func (*Network) Release Uses

func (n *Network) Release()

Release returns this network to the Pool

func (*Network) SetHandler Uses

func (n *Network) SetHandler(handler http.Handler)

SetHandler sets the http.handler for meta-data service for this tap-device.

type Pool Uses

type Pool struct {
    // contains filtered or unexported fields
}

Pool manages a static set of networks (TAP devices).

func NewPool Uses

func NewPool(N int) (*Pool, error)

NewPool creates N virtual networks and returns Pool. This should be called before the worker starts operating, we don't wish to dynamically reconfigure networks at runtime.

func (*Pool) Dispose Uses

func (p *Pool) Dispose() error

Dispose deletes all the networks created, should not be called while any of networks are in use.

func (*Pool) Network Uses

func (p *Pool) Network() (*Network, error)

Network returns an unused network, or nil if no network is available.

type UserNetwork Uses

type UserNetwork struct {
    // contains filtered or unexported fields
}

UserNetwork provides an unsafe network implementation for use when building and testing images locally (without root access).

func NewUserNetwork Uses

func NewUserNetwork(socketFolder string) (*UserNetwork, error)

NewUserNetwork returns a Network implementation using the QEMU user-space network stack. This doesn't provide the same level of isolation, but the meta-data service should be sufficiently isolated.

func (*UserNetwork) NetDev Uses

func (n *UserNetwork) NetDev(ID string) string

NetDev returns the argument for the QEMU option -netdev

func (*UserNetwork) Release Uses

func (n *UserNetwork) Release()

Release frees all resources used by this network.

func (*UserNetwork) SetHandler Uses

func (n *UserNetwork) SetHandler(handler http.Handler)

SetHandler takes an http.Handler to be used for meta-data requests.

Package network imports 19 packages (graph) and is imported by 3 packages. Updated 2017-03-12. Refresh now. Tools for package owners.