Documentation
¶
Index ¶
Constants ¶
View Source
const ( StatusNone = "NONE" StatusAllocated = "ALLOCATED" )
Variables ¶
View Source
var DriversList []ResourceDriver
Functions ¶
This section is empty.
Types ¶
type Disk ¶
type Disk struct {
Type string `json:"type"` // Type of the filesystem to create
Label string `json:"label"` // Volume name will be given to the disk, empty will use the disk key
Size uint `json:"size"` // Amount of disk space in GB
Reuse bool `json:"reuse"` // Do not remove the disk and reuse it for the next resource run
Clone string `json:"clone"` // Clone the snapshot of existing disk instead of creating the new one
}
type Requirements ¶
type Requirements struct {
Cpu uint `json:"cpu"` // Number of CPU cores to use
Ram uint `json:"ram"` // Amount of memory in GB
Disks map[string]Disk `json:"disks"` // Disks to create and connect
Network string `json:"network"` // Which network configuration to use for VM
}
Resource requirements
type ResourceDriver ¶
type ResourceDriver interface {
// Name of the driver
Name() string
// Give driver configs and check if it's ok
// -> config - driver configuration in json format
Prepare(config []byte) error
// Make sure the allocate definition is appropriate
// -> definition - describes the driver options to allocate the required resource
ValidateDefinition(definition string) error
// Allocate the resource by definition and returns hw address
// -> definition - describes the driver options to allocate the required resource
// -> metadata - user metadata to use during resource allocation
// <- hwaddr - mandatory, needed to identify the resource. If it's a MAC address - it is used to auth in Meta API
// <- ipaddr - optional, if driver can provide the assigned IP address of the instance
Allocate(definition string, metadata map[string]interface{}) (hwaddr, ipaddr string, err error)
// Get the status of the resource with given hw address
Status(hwaddr string) string
// Makes environment snapshot of the resource with given hw address
// -> hwaddr - driver identifier of the resource
// -> full - will try it's best to make the complete snapshot of the environment, else just non-image data (attached disks)
// <- info - where to find the snapshots
Snapshot(hwaddr string, full bool) (info string, err error)
// Deallocate resource with provided hw addr
// -> hwaddr - driver identifier of the resource
Deallocate(hwaddr string) error
}
Click to show internal directories.
Click to hide internal directories.