instances

package
v0.0.0-...-6cf1bc9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CpuPower

func CpuPower(power uint64) *uint64

Types

type Image

type Image struct {
	Id   string
	Arch string
	// The type of virtualisation supported by this image.
	VirtType string
}

Image holds the attributes that vary amongst relevant images for a given series in a given region.

func ImageMetadataToImages

func ImageMetadataToImages(inputs []*imagemetadata.ImageMetadata) []Image

ImageMetadataToImages converts an array of ImageMetadata pointers (as returned by imagemetadata.Fetch) to an array of Image objects (as required by instances.FindInstanceSpec).

type InstanceConstraint

type InstanceConstraint struct {
	Region      string
	Series      string
	Arches      []string
	Constraints constraints.Value

	// Storage specifies a list of storage types, in order of preference.
	// eg ["ssd", "ebs"] means find images with ssd storage, but if none
	// exist, find those with ebs instead.
	Storage []string
}

InstanceConstraint constrains the possible instances that may be chosen by the environment provider.

func (*InstanceConstraint) String

func (ic *InstanceConstraint) String() string

String returns a human readable form of this InstanceConstraint.

type InstanceSpec

type InstanceSpec struct {
	InstanceType InstanceType
	Image        Image
	// contains filtered or unexported fields
}

InstanceSpec holds an instance type name and the chosen image info.

func FindInstanceSpec

func FindInstanceSpec(possibleImages []Image, ic *InstanceConstraint, allInstanceTypes []InstanceType) (*InstanceSpec, error)

FindInstanceSpec returns an InstanceSpec satisfying the supplied InstanceConstraint. possibleImages contains a list of images matching the InstanceConstraint. allInstanceTypes provides information on every known available instance type (name, memory, cpu cores etc) on which instances can be run. The InstanceConstraint is used to filter allInstanceTypes and then a suitable image compatible with the matching instance types is returned.

type InstanceType

type InstanceType struct {
	Id       string
	Name     string
	Arches   []string
	CpuCores uint64
	Mem      uint64
	Cost     uint64
	RootDisk uint64
	// These attributes are not supported by all clouds.
	VirtType   *string // The type of virtualisation used by the hypervisor, must match the image.
	CpuPower   *uint64
	Tags       []string
	Deprecated bool
}

InstanceType holds all relevant attributes of the various instance types.

func MatchingInstanceTypes

func MatchingInstanceTypes(allInstanceTypes []InstanceType, region string, cons constraints.Value) ([]InstanceType, error)

MatchingInstanceTypes returns all instance types matching constraints and available in region, sorted by increasing region-specific cost (if known).

Jump to

Keyboard shortcuts

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