deployer

package
v0.0.0-...-3a64f8a Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Represents any artifact crated by deployer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostProcessProgress

func PostProcessProgress(c *CommonData, p PostProcessor, artifacts []Artifact) error

PostProcessProgress is responsible for representing a progress during post-processing of appropriate artifact.

Types

type Artifact

type Artifact interface {
	// Artifact ID.
	GetName() string

	// Path to artifact.
	GetPath() string

	// Artifact type (either ImageArtifact or MetadataArtifact).
	GetType() ArtifactType

	// Destroys the artifact.
	Destroy() error

	// Print properties
	String() string
}

Artifact is the interface to a real artifact implementation. Any artifact object must implement this interface.

func Build

func Build(builders []Builder) ([]Artifact, error)

Build iterates over a slice of builders and runs each builder in a separated goroutine. Returns a slice of artifacts.

func BuildProgress

func BuildProgress(c *CommonData, builders []Builder) (artifacts []Artifact, err error)

BuildProgress is responsible for running appropriate builders and representing a progress bar providing information about the build progress.

type ArtifactType

type ArtifactType uint8
const (
	ImageArtifact ArtifactType = iota
	MetadataArtifact
)

type Builder

type Builder interface {
	// Id of the build
	Id() string

	// Run the build
	Run() (Artifact, error)
}

Implementers of the interface are responsible for creating appropriate artifact.

type CommonArtifact

type CommonArtifact struct {
	Name      string
	Path      string
	Type      ArtifactType
	SshConfig *ssh.Config
}

CommonArtifact represents an artifact properties.

func (*CommonArtifact) Destroy

func (a *CommonArtifact) Destroy() error

Destroy is responsible for removing appropriate artifact.

func (*CommonArtifact) GetName

func (a *CommonArtifact) GetName() string

GetName returns artifact's name.

func (*CommonArtifact) GetPath

func (a *CommonArtifact) GetPath() string

GetPath returns artifact's path.

func (*CommonArtifact) GetType

func (a *CommonArtifact) GetType() ArtifactType

GetType returns artifact's type (metadata or image).

func (*CommonArtifact) String

func (a *CommonArtifact) String() string

type CommonConfig

type CommonConfig struct {
	// RemoteMode indicates whether the deployment occures remotely.
	RemoteMode bool

	// ExportDir is a directory for storing appropriate artifacts.
	ExportDir string

	// SshConfig represents ssh configuration.
	SshConfig *ssh.Config

	// Parsed storage configuration file
	StorageConfig *image.Storage
}

CommonConfig represents common configuration generated during either user input or pasing appropriate configuration file.

type CommonData

type CommonData struct {
	// Directory containing components required for
	// creating the target appliance.
	RootDir string

	// Directory that will be used as a mount point for root partition.
	RootfsMp string

	// DefaultExportDir represents default directory for created artifact.
	DefaultExportDir string

	// VaName represents default name for the virtual appliance.
	VaName string

	// Arch represents archirecture we'r running on.
	Arch string

	// Ui represents appropriate dialog based user interface.
	Ui *ui.DialogUi
}

CommonData represents the data required by deployer at any stage.

type DirBuilderData

type DirBuilderData struct {
	// Filler - implementation of RootfsFiller interface.
	Filler RootfsFiller

	// RootfsPath - path to rootfs
	RootfsPath string
}

DirBuilderData represents the common data needed by appropriate image builder.

type EnvDriver

type EnvDriver interface {
	// Returns the driver identificator
	Id() string

	// Creates appropriate domain.
	DefineDomain(string) error

	// Starts appliance.
	StartDomain(string) error

	// Stops appliance
	DestroyDomain(string) error

	// Removes appliance definitions(metadata)
	// and its references(doesn't remove appliance image).
	UndefineDomain(string) error

	// Sets appliance to start on host boot.
	SetAutostart(string) error

	// Returns true if the given domain exists.
	DomainExists(string) bool

	// Returns path to emulator(QEMU for example).
	Emulator(arch string) (string, error)

	// Returns driver version (for example if the driver is libvirt the function
	// will return libvirt API version)
	Version() (string, error)

	// Returns maximal Virtual CPUs per guest
	MaxVCPUsPerGuest() int

	// Returns true if all Virtual Appliances in the farm configured for one-to-one CPU pinning
	AllCPUsPinned() (bool, error)
}

EnvDriver is the interface that has to be implemented in order to communicate with VM over API belonging to appropriate environment

type FlowCreator

type FlowCreator interface {
	// Creates appropriate config data needed for
	// creating builders,provisioners and post-processors.
	CreateConfig(*CommonData) error

	// Creates builders.
	CreateBuilders(*CommonData) ([]Builder, error)

	// Creates a post-processor.
	CreatePostProcessor(*CommonData) (PostProcessor, error)
}

FlowCreator is the main deployer interface.

type HostinfoDriver

type HostinfoDriver interface {
	// Initialize the driver
	Init() error

	// Returns amount of installed RAM.
	RAMSize() (int, error)

	// Returns available CPUs.
	CPUs() (int, error)

	// Returns information related to the host's CPU.
	CPUInfo() (*host.CPU, error)

	// Returns information about installed NUMA nodes
	NUMAInfo() (host.NUMANodes, error)

	// Returns info related to the host's NICs.
	NICs() (host.NICList, error)
}

HostinfoDriver is the interface that has to be implemented in order to gather appropriate HW information from either local or remote host

type ImageBuilderData

type ImageBuilderData struct {
	// ImageConfig - XML metadata containing image topology configuration.
	ImageConfig *image.Disk

	// Filler - implementation of deployer.RootfsFiller interface.
	Filler RootfsFiller

	// RootfsMp - path to the mount point where the image
	// artifact will be mounted during customization.
	RootfsMp string
}

ImageBuilderData represents the common data needed by appropriate image builder.

type MetadataBuilderData

type MetadataBuilderData struct {
	// Source - path to a source metadata artifact.
	Source string

	// Dest - path to destination metadata artifact.
	Dest string

	// UserData - any data provided by user and that will be
	// written to destination metadata.
	UserData interface{}
}

MetadataBuilderData represents the common data needed by appropriate metadata builder.

type MetadataConfigurator

type MetadataConfigurator interface {
	// CPU configuration
	// Returns metadata entry related to the guest CPU configuration
	SetCpuConfigData(*guest.Config, string, interface{}) (string, error)

	// vCPU and list of physical CPUs the vCPU is bound to and templates directory.
	// Returns vCPU related metadata entry and error.
	SetCpuTuneData(*guest.Config, string, interface{}) (string, error)

	// NUMA configuration
	// Returns NUMA tuning related metadata entry and error.
	SetNUMATuneData(*guest.Config, string, interface{}) (string, error)

	// Storage configuration and templates directory.
	// Returns storage related metadata entry and error.
	SetStorageData(*guest.Config, string, interface{}) (string, error)

	// Network interfaces information, templates directory.
	// Returns metadata entry related to the network interfaces configuration and error.
	SetNetworkData(*guest.Config, string, interface{}) (string, error)

	// Allows to implement a custom logic related to a metadata configuration.
	// Returns a metadata entry and error.
	SetCustomData(*guest.Config, string, interface{}) (string, error)

	// Default metadata is used by deployer in case user didn't provide any template.
	// Returns entry related to default metadata.
	DefaultMetadata() []byte
}

MetadataConfigurator is the interface that has to be implemented in order to manipulate appropriate metadata. The methods receive guest configuration, path to a custom template and additional optional data represented as interface{}

type PostProcessor

type PostProcessor interface {
	// Processes given artifacts
	PostProcess([]Artifact) error
}

PostProcessor is the interface that has to be implemented in order to post-process appropriate artifact.

type RootfsFiller

type RootfsFiller interface {
	// Responsible for extracting/populting rootfs.
	// Receives rootfs mount point.
	CustomizeRootfs(string) error

	// Responsible for application installation.
	// Receives rootfs mount point.
	InstallApp(string) error

	// Responsible for executing hooks
	// The method might be usefull for cases
	// when rootfs postprocessing is required
	RunHooks(string) error
}

Implementers of Rootfs are responsible for populating rootfs and installing stuff belonging to application.

Jump to

Keyboard shortcuts

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