vm

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2014 License: Apache-2.0 Imports: 12 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) AttachPersistentDisk

func (ae AgentEnv) AttachPersistentDisk(diskID, path string) AgentEnv

func (AgentEnv) DetachPersistentDisk

func (ae AgentEnv) DetachPersistentDisk(diskID string) AgentEnv

type AgentEnvService

type AgentEnvService interface {
	// Fetch will return an error if Update was not called beforehand
	Fetch() (AgentEnv, error)
	Update(AgentEnv) error
}

type AgentEnvServiceFactory

type AgentEnvServiceFactory interface {
	New() AgentEnvService
}

type AgentOptions

type AgentOptions struct {
	// e.g. "https://user:password@127.0.0.1:4321/agent"
	Mbus string

	// e.g. ["0.us.pool.ntp.org"]. Ok to be empty
	NTP []string

	Blobstore BlobstoreOptions
}

func (AgentOptions) Validate

func (o AgentOptions) Validate() error

type BlobstoreOptions

type BlobstoreOptions struct {
	// e.g. local
	Type string

	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 takes an agent id and creates a VM with provided configuration
	Create(string, bslcstem.Stemcell, VMCloudProperties, Networks, Environment) (VM, error)
}

type DisksSpec

type DisksSpec struct {
	Persistent PersistentSpec `json:"persistent"`
}

type EnvSpec

type EnvSpec map[string]interface{}

type Environment

type Environment map[string]interface{}

type Finder

type Finder interface {
	Find(int) (VM, bool, error)
}

type GuestBindMounts

type GuestBindMounts interface {
	MakeEphemeral() string
	MakePersistent() string
	MountPersistent(diskID string) string
}

type HostBindMounts

type HostBindMounts interface {
	MakeEphemeral(id string) (string, error)
	DeleteEphemeral(id string) error

	MakePersistent(id string) (string, error)
	DeletePersistent(id string) error

	MountPersistent(id, diskID, diskPath string) error
	UnmountPersistent(id, diskID string) error
}

type Network

type Network struct {
	Type string

	IP      string
	Netmask string
	Gateway string

	DNS     []string
	Default []string

	CloudProperties map[string]interface{}
}

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"`

	CloudProperties map[string]interface{} `json:"cloud_properties"`
}

type Networks

type Networks map[string]Network

func (Networks) First

func (ns Networks) First() Network

type NetworksSpec

type NetworksSpec map[string]NetworkSpec

type NotSupportedError

type NotSupportedError struct{}

func (NotSupportedError) Error

func (e NotSupportedError) Error() string

func (NotSupportedError) Type

func (e NotSupportedError) Type() string

type PersistentSpec

type PersistentSpec map[string]string

type SoftLayerAgentEnvService

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

func NewSoftLayerAgentEnvService

func NewSoftLayerAgentEnvService(
	logger boshlog.Logger,
) SoftLayerAgentEnvService

func (SoftLayerAgentEnvService) Fetch

func (SoftLayerAgentEnvService) Update

func (s SoftLayerAgentEnvService) Update(agentEnv AgentEnv) error

type SoftLayerAgentEnvServiceFactory

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

func NewSoftLayerAgentEnvServiceFactory

func NewSoftLayerAgentEnvServiceFactory(logger boshlog.Logger) SoftLayerAgentEnvServiceFactory

func (SoftLayerAgentEnvServiceFactory) New

type SoftLayerCreator

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

func NewSoftLayerCreator

func NewSoftLayerCreator(softLayerClient sl.Client, agentEnvServiceFactory AgentEnvServiceFactory, agentOptions AgentOptions, logger boshlog.Logger) SoftLayerCreator

func (SoftLayerCreator) Create

func (c SoftLayerCreator) Create(agentID string, stemcell bslcstem.Stemcell, cloudProps VMCloudProperties, networks Networks, env Environment) (VM, error)

type SoftLayerFinder

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

func NewSoftLayerFinder

func NewSoftLayerFinder(softLayerClient sl.Client, agentEnvServiceFactory AgentEnvServiceFactory, logger boshlog.Logger) SoftLayerFinder

func (SoftLayerFinder) Find

func (f SoftLayerFinder) Find(vmID int) (VM, bool, error)

type SoftLayerVM

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

func NewSoftLayerVM

func NewSoftLayerVM(id int, softLayerClient sl.Client, agentEnvService AgentEnvService, logger boshlog.Logger) SoftLayerVM

func (SoftLayerVM) AttachDisk

func (vm SoftLayerVM) AttachDisk(disk bslcdisk.Disk) error

func (SoftLayerVM) ConfigureNetworks

func (vm SoftLayerVM) ConfigureNetworks(networks Networks) error

func (SoftLayerVM) Delete

func (vm SoftLayerVM) Delete() error

func (SoftLayerVM) DetachDisk

func (vm SoftLayerVM) DetachDisk(disk bslcdisk.Disk) error

func (SoftLayerVM) ID

func (vm SoftLayerVM) ID() int

func (SoftLayerVM) Reboot

func (vm SoftLayerVM) Reboot() error

func (SoftLayerVM) SetMetadata

func (vm SoftLayerVM) SetMetadata(vmMetadata VMMetadata) error

type VM

type VM interface {
	ID() int

	Delete() error
	Reboot() error

	SetMetadata(VMMetadata) error
	ConfigureNetworks(Networks) error

	AttachDisk(bslcdisk.Disk) error
	DetachDisk(bslcdisk.Disk) error
}

type VMCloudProperties

type VMCloudProperties struct {
	Domain                   string `json:"domain,omitempty"`
	StartCpus                int    `json:"startCpus,omitempty"`
	MaxMemory                int    `json:"maxMemory,omitempty"`
	Datacenter               sldatatypes.Datacenter
	BlockDeviceTemplateGroup sldatatypes.BlockDeviceTemplateGroup
	SshKeys                  []sldatatypes.SshKey `json:"sshKeys"`
}

type VMMetadata

type VMMetadata struct {
	VMCloudProperties VMCloudProperties `json:"cloud_properties,omitempty"`
}

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