Documentation ¶
Index ¶
- Constants
- Variables
- type Cluster
- func (c *Cluster) AttachDisk(v *disk.VmDisk, region string) error
- func (c *Cluster) AttachNics(policy *provision.PolicyOps, vmid, region, storage string) error
- func (c *Cluster) AvailIps(names, ips []string, vnets *onenet.VNetPool, region string) ([]*template.NIC, error)
- func (c *Cluster) CreateVM(opts compute.VirtualMachine, throttle, storage string, nics []*template.NIC) (string, string, string, error)
- func (c *Cluster) DestroyVM(opts compute.VirtualMachine) error
- func (c *Cluster) DetachDisk(v *disk.VmDisk, region string) error
- func (c *Cluster) DetachNics(net_ids []string, vmid, region string) error
- func (c *Cluster) ForceDestoryVM(opts compute.VirtualMachine) error
- func (c *Cluster) ForceRestartVM(opts compute.VirtualMachine) error
- func (c *Cluster) ForceStopVM(opts compute.VirtualMachine) error
- func (c *Cluster) GetDiskId(vd *disk.VmDisk, region string) ([]int, error)
- func (c *Cluster) GetImage(opts images.Image, region string) (*images.Image, error)
- func (c *Cluster) GetIpsNetwork(region string, Ips map[string][]string) ([]*template.NIC, error)
- func (c *Cluster) GetTemplate(region string) (*template.UserTemplate, error)
- func (c *Cluster) GetVM(opts virtualmachine.Vnc, region string) (*virtualmachine.VM, error)
- func (c *Cluster) GetVNetPool(region string) (*onenet.VNetPool, error)
- func (c *Cluster) GetVNets(region string) (*onenet.VNetPool, error)
- func (c *Cluster) ImageCreate(opts images.Image, region string) (interface{}, error)
- func (c *Cluster) ImagePersistent(opts images.Image, region string) error
- func (c *Cluster) ImageTypeChange(opts images.Image, region string) error
- func (c *Cluster) InstantiateVM(opts *template.UserTemplate, vname, throttle, region string) (string, error)
- func (c *Cluster) IsImageReady(v *images.Image, region string) error
- func (c *Cluster) IsSnapReady(v *images.Image, region string) error
- func (c *Cluster) Nodes() ([]Node, error)
- func (c *Cluster) Register(node Node) error
- func (c *Cluster) RemoveImage(opts compute.Image) error
- func (c *Cluster) RemoveSnap(opts snapshot.Snapshot, region string) error
- func (c *Cluster) RestartVM(opts compute.VirtualMachine) error
- func (c *Cluster) RestoreSnap(opts snapshot.Snapshot, region string) error
- func (c *Cluster) SaveDiskImage(opts compute.Image) (string, error)
- func (c *Cluster) Showback(start int64, end int64, region string) ([]interface{}, error)
- func (c *Cluster) SnapVMDisk(opts snapshot.Snapshot, region string) (string, error)
- func (c *Cluster) StartVM(opts compute.VirtualMachine) error
- func (c *Cluster) StopVM(opts compute.VirtualMachine) error
- func (c *Cluster) SuspendVM(opts compute.VirtualMachine) error
- func (c *Cluster) UnfilteredNodes() ([]Node, error)
- func (c *Cluster) Unregister(region string) error
- func (c *Cluster) UnregisterNodes(regions ...string) error
- func (c *Cluster) UpdateNode(node Node) (Node, error)
- func (c *Cluster) VM(opts compute.VirtualMachine, action string) error
- type ClusterHook
- type DefaultHealer
- type Healer
- type HealingData
- type MapStorage
- func (s *MapStorage) ExtendNodeLock(region string, timeout time.Duration) error
- func (s *MapStorage) LockNodeForHealing(region string, isFailure bool, timeout time.Duration) (bool, error)
- func (s *MapStorage) RemoveNode(region string) error
- func (s *MapStorage) RemoveNodes(regions []string) error
- func (s *MapStorage) RetrieveNode(region string) (Node, error)
- func (s *MapStorage) RetrieveNodes() ([]Node, error)
- func (s *MapStorage) StoreNode(node Node) error
- func (s *MapStorage) UnlockNode(region string) error
- func (s *MapStorage) UpdateNode(node Node) error
- type Node
- type NodeList
- type NodeStorage
- type OneNodeError
- type Storage
Constants ¶
View Source
const ( NodeStatusWaiting = "waiting" NodeStatusReady = "ready" NodeStatusRetry = "ready for retry" NodeStatusTemporarilyDisabled = "temporarily disabled" NodeStatusHealing = "healing" NodeCreationStatusCreated = "created" NodeCreationStatusError = "error" NodeCreationStatusPending = "pending" NodeCreationStatusDisabled = "disabled" )
Variables ¶
View Source
var ( ErrNoSuchNode = errors.New("No such node in storage") ErrDuplicatedNodeAddress = errors.New("Node address shouldn't repeat") )
View Source
var ErrConnRefused = errors.New("connection refused")
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { Healer Healer Hook ClusterHook // contains filtered or unexported fields }
Cluster is the basic type of the package. It manages internal nodes, and provide methods for interaction with those nodes
func New ¶
New creates a new Cluster, initially composed by the given nodes. The storage parameter is the storage the cluster instance will use.
func (*Cluster) AttachNics ¶
func (*Cluster) DestroyVM ¶
func (c *Cluster) DestroyVM(opts compute.VirtualMachine) error
DestroyVM kills a vm, returning an error in case of failure.
func (*Cluster) DetachNics ¶
func (*Cluster) ForceDestoryVM ¶
func (c *Cluster) ForceDestoryVM(opts compute.VirtualMachine) error
DestroyVM kills a vm, returning an error in case of failure.
func (*Cluster) ForceRestartVM ¶
func (c *Cluster) ForceRestartVM(opts compute.VirtualMachine) error
func (*Cluster) ForceStopVM ¶
func (c *Cluster) ForceStopVM(opts compute.VirtualMachine) error
func (*Cluster) GetIpsNetwork ¶
func (*Cluster) GetTemplate ¶
func (c *Cluster) GetTemplate(region string) (*template.UserTemplate, error)
func (*Cluster) GetVM ¶
func (c *Cluster) GetVM(opts virtualmachine.Vnc, region string) (*virtualmachine.VM, error)
func (*Cluster) GetVNetPool ¶
func (*Cluster) ImageCreate ¶
func (*Cluster) ImagePersistent ¶
func (*Cluster) ImageTypeChange ¶
func (*Cluster) InstantiateVM ¶
func (*Cluster) RemoveSnap ¶
func (*Cluster) RestoreSnap ¶
func (*Cluster) SnapVMDisk ¶
func (*Cluster) UnfilteredNodes ¶
func (*Cluster) Unregister ¶
Unregister removes nodes from the cluster.
func (*Cluster) UnregisterNodes ¶
type ClusterHook ¶
type DefaultHealer ¶
type DefaultHealer struct{}
func (DefaultHealer) HandleError ¶
func (DefaultHealer) HandleError(node *Node) time.Duration
type HealingData ¶
type MapStorage ¶
type MapStorage struct {
// contains filtered or unexported fields
}
func (*MapStorage) ExtendNodeLock ¶
func (s *MapStorage) ExtendNodeLock(region string, timeout time.Duration) error
func (*MapStorage) LockNodeForHealing ¶
func (*MapStorage) RemoveNode ¶
func (s *MapStorage) RemoveNode(region string) error
func (*MapStorage) RemoveNodes ¶
func (s *MapStorage) RemoveNodes(regions []string) error
func (*MapStorage) RetrieveNode ¶
func (s *MapStorage) RetrieveNode(region string) (Node, error)
func (*MapStorage) RetrieveNodes ¶
func (s *MapStorage) RetrieveNodes() ([]Node, error)
func (*MapStorage) StoreNode ¶
func (s *MapStorage) StoreNode(node Node) error
func (*MapStorage) UnlockNode ¶
func (s *MapStorage) UnlockNode(region string) error
func (*MapStorage) UpdateNode ¶
func (s *MapStorage) UpdateNode(node Node) error
type Node ¶
type Node struct { Address string Region string `json:"_id"` Healing HealingData Metadata map[string]string Clusters map[string]map[string][]string CreationStatus string }
Node represents a farm with endpoint of One. Each node has an Address (in the form <scheme>://<host>:<port>/RPC2) and map with arbritary metadata.
func (*Node) CleanMetadata ¶
func (*Node) FailureCount ¶
func (*Node) HasSuccess ¶
func (Node) MarshalJSON ¶
func (*Node) ResetFailures ¶
func (n *Node) ResetFailures()
type NodeStorage ¶
type NodeStorage interface { StoreNode(node Node) error RetrieveNodes() ([]Node, error) RetrieveNode(address string) (Node, error) UpdateNode(node Node) error RemoveNode(address string) error RemoveNodes(addresses []string) error LockNodeForHealing(address string, isFailure bool, timeout time.Duration) (bool, error) ExtendNodeLock(address string, timeout time.Duration) error UnlockNode(address string) error }
type OneNodeError ¶
type OneNodeError struct {
// contains filtered or unexported fields
}
func (OneNodeError) BaseError ¶
func (n OneNodeError) BaseError() error
func (OneNodeError) Error ¶
func (n OneNodeError) Error() string
type Storage ¶
type Storage interface { NodeStorage }
Click to show internal directories.
Click to hide internal directories.