vm

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2017 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentEnv

type AgentEnv struct {
	AgentID string `json:"agent_id"`

	VM VMSpec `json:"vm"`

	Mbus string   `json:"mbus"`
	NTP  []string `json:"ntp"`

	Blobstore BlobstoreSpec `json:"blobstore"`

	Networks NetworksSpec `json:"networks"`

	Disks DisksSpec `json:"disks"`

	Env EnvSpec `json:"env"`
}

func NewAgentEnvForVM

func NewAgentEnvForVM(agentID, vmCID string, networks Networks, env Environment, agentOptions AgentOptions) AgentEnv

func NewAgentEnvFromJSON

func NewAgentEnvFromJSON(bytes []byte) (AgentEnv, error)

func (AgentEnv) AttachEphemeralDisk

func (ae AgentEnv) AttachEphemeralDisk(hint interface{}) AgentEnv

func (AgentEnv) AttachPersistentDisk

func (ae AgentEnv) AttachPersistentDisk(diskID string, hint interface{}) AgentEnv

func (AgentEnv) DetachPersistentDisk

func (ae AgentEnv) DetachPersistentDisk(diskID string) AgentEnv

type AgentOptions

type AgentOptions struct {
	Mbus      string   // e.g. "https://user:password@127.0.0.1:4321/agent"
	NTP       []string // e.g. ["0.us.pool.ntp.org"]. Ok to be empty
	Blobstore BlobstoreOptions
}

func (AgentOptions) Validate

func (o AgentOptions) Validate() error

type BlobstoreOptions

type BlobstoreOptions struct {
	Type    string `json:"provider"`
	Options map[string]interface{}
}

func (BlobstoreOptions) Validate

func (o BlobstoreOptions) Validate() error

type BlobstoreSpec

type BlobstoreSpec struct {
	Provider string                 `json:"provider"`
	Options  map[string]interface{} `json:"options"`
}

type Creator

type Creator interface {
	Create(string, bstem.Stemcell, VMProps, Networks, Environment) (VM, error)
}

type DisksSpec

type DisksSpec struct {
	System     string         `json:"system"`
	Ephemeral  interface{}    `json:"ephemeral"`
	Persistent PersistentSpec `json:"persistent"`
}

type EnvSpec

type EnvSpec map[string]interface{}

type Environment

type Environment map[string]interface{}

type Factory

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

func NewFactory

func NewFactory(
	opts FactoryOpts,
	uuidGen boshuuid.Generator,
	driver driver.Driver,
	runner driver.Runner,
	diskFactory bdisk.Factory,
	agentOptions AgentOptions,
	logger boshlog.Logger,
) Factory

func (Factory) Create

func (f Factory) Create(agentID string, stemcell bstem.Stemcell, props VMProps, networks Networks, env Environment) (VM, error)

func (Factory) Find

func (f Factory) Find(id string) (VM, error)

type FactoryOpts added in v0.0.6

type FactoryOpts struct {
	DirPath            string
	StorageController  string
	AutoEnableNetworks bool
}

type Finder

type Finder interface {
	Find(string) (VM, error)
}

type Host added in v0.0.7

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

func (Host) EnableNetworks added in v0.0.7

func (h Host) EnableNetworks(nets Networks) error

func (Host) FindNetwork added in v0.0.9

func (h Host) FindNetwork(net Network) (bnet.Network, error)

type ISO9660

type ISO9660 struct {
	FileName string
	Contents []byte
}

More or less vendored from https://github.com/johto/iso9660wrap/blob/master/iso9660wrap.go

func (ISO9660) Bytes

func (i ISO9660) Bytes() ([]byte, error)

type NICs

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

func (NICs) Configure

func (n NICs) Configure(nets Networks, host Host) (Networks, error)

type Network

type Network struct {
	Type string

	IP      string
	Netmask string
	Gateway string

	DNS     []string
	Default []string

	MAC string

	CloudPropertyName string
	CloudPropertyType string
}

func (Network) IsDefaultFor

func (n Network) IsDefaultFor(what string) bool

func (Network) IsDynamic

func (n Network) IsDynamic() bool

type NetworkSpec

type NetworkSpec struct {
	Type string `json:"type"`

	IP      string `json:"ip"`
	Netmask string `json:"netmask"`
	Gateway string `json:"gateway"`

	DNS     []string `json:"dns"`
	Default []string `json:"default"`

	MAC string `json:"mac"`

	Preconfigured bool `json:"preconfigured"`
}

type Networks

type Networks map[string]Network

func (Networks) Default

func (ns Networks) Default() Network

type NetworksSpec

type NetworksSpec map[string]NetworkSpec

type PersistentSpec

type PersistentSpec map[string]interface{}

type Store

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

func NewStore

func NewStore(path string, runner driver.Runner) Store

func (Store) Delete

func (m Store) Delete() error

func (Store) DeleteOne

func (m Store) DeleteOne(key string) error

func (Store) Get

func (m Store) Get(key string) ([]byte, error)

func (Store) List

func (m Store) List() ([]string, error)

func (Store) Path

func (m Store) Path(key string) string

func (Store) Put

func (m Store) Put(key string, contents []byte) error

type VM

type VM interface {
	ID() string
	SetMetadata(VMMetadata) error

	Reboot() error
	Exists() (bool, error)
	Delete() error

	DiskIDs() ([]string, error)
	AttachDisk(bdisk.Disk) error
	AttachEphemeralDisk(bdisk.Disk) error
	DetachDisk(bdisk.Disk) error
}

type VMImpl

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

func NewVMImpl

func NewVMImpl(
	id string,
	portDevices bpds.PortDevices,
	store Store,
	driver driver.Driver,
	logger boshlog.Logger,
) VMImpl

func (VMImpl) AttachDisk

func (vm VMImpl) AttachDisk(disk bdisk.Disk) error

func (VMImpl) AttachEphemeralDisk

func (vm VMImpl) AttachEphemeralDisk(disk bdisk.Disk) error

func (VMImpl) ConfigureAgent

func (vm VMImpl) ConfigureAgent(agentEnv AgentEnv) error

func (VMImpl) ConfigureNICs

func (vm VMImpl) ConfigureNICs(nets Networks, host Host) (Networks, error)

func (VMImpl) Delete

func (vm VMImpl) Delete() error

func (VMImpl) DetachDisk

func (vm VMImpl) DetachDisk(disk bdisk.Disk) error

func (VMImpl) DiskIDs

func (vm VMImpl) DiskIDs() ([]string, error)

func (VMImpl) Exists

func (vm VMImpl) Exists() (bool, error)

func (VMImpl) HaltIfRunning

func (vm VMImpl) HaltIfRunning() error

func (VMImpl) ID

func (vm VMImpl) ID() string

func (VMImpl) IsRunning

func (vm VMImpl) IsRunning() (bool, error)

func (VMImpl) Reboot

func (vm VMImpl) Reboot() error

func (VMImpl) SetMetadata

func (vm VMImpl) SetMetadata(meta VMMetadata) error

func (VMImpl) SetProps

func (vm VMImpl) SetProps(props VMProps) error

func (VMImpl) Start

func (vm VMImpl) Start(gui bool) error

func (VMImpl) State

func (vm VMImpl) State() (string, error)

type VMMetadata

type VMMetadata map[string]interface{}

type VMProps

type VMProps struct {
	Memory        int // 512
	CPUs          int // 1
	EphemeralDisk int

	GUI              bool
	ParavirtProvider string // minimal
}

type VMSpec

type VMSpec struct {
	Name string `json:"name"`
	ID   string `json:"id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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