Documentation
¶
Index ¶
- Constants
- Variables
- func GetNvPairValue(elem *xmltree.Element, name string) (*xmltree.Attr, error)
- type CIB
- func (c *CIB) CreateResource(xml string) error
- func (c *CIB) DissolveConstraints(delItems []string)
- func (c *CIB) FindLrmState(id string) LrmRunState
- func (c *CIB) FindNodeState(uname string) (NodeState, error)
- func (c *CIB) FindResource(id string) *xmltree.Element
- func (c *CIB) GetClusterName() (string, error)
- func (c *CIB) GetNodeID(uname string) (int, error)
- func (c *CIB) GetNodeOfResource(resource string) string
- func (c *CIB) GetStonithEnabled() (bool, error)
- func (c *CIB) IsStandbyNode(nodeUname string) (bool, error)
- func (c *CIB) ListNodes() ([]Node, error)
- func (c *CIB) ListResourcesOnNode(node string) ([]string, error)
- func (c *CIB) ReadConfiguration() error
- func (c *CIB) SetClusterName(value string) error
- func (c *CIB) SetStonithEnabled(value bool) error
- func (c *CIB) StandbyNode(nodeUname string) error
- func (c *CIB) StartResource(id string) error
- func (c *CIB) StopResource(id string) error
- func (c *CIB) UnStandbyNode(nodeUname string) error
- func (c *CIB) Update() error
- func (c *CIB) WaitForResourcesStop(idsToStop []string) (bool, error)
- type ClusterProperty
- type LrmRunState
- type Node
- type NodeState
Constants ¶
const ( JoinDown joinState = "down" JoinPending joinState = "pending" JoinMember joinState = "member" JoinBanned joinState = "banned" )
Variables ¶
var (
ErrCibFailed = errors.New("Failed to read the CRM configuration")
)
Functions ¶
Types ¶
type CIB ¶
func (*CIB) CreateResource ¶
func (*CIB) DissolveConstraints ¶
Removes CRM constraints that refer to the specified delItems names from the CIB XML document tree
func (*CIB) FindLrmState ¶
func (c *CIB) FindLrmState(id string) LrmRunState
func (*CIB) FindNodeState ¶ added in v0.1.1
func (*CIB) GetClusterName ¶ added in v0.1.5
func (*CIB) GetNodeOfResource ¶ added in v0.1.4
GetNodeOfResource finds the node on which a resource is currently running. For this, it looks at the node_state element in a hierarchy like this:
<cib> <status> <node_state> <lrm> <lrm_resources> <lrm_resource> ... </lrm_resource> </lrm_resources> </lrm> </node_state> </status> </cib>
It will try to find an <lrm_resource> with an 'id' attribute corresponding to the resource name in question. If this is not found, an empty string is returned, signalling that the resource is not configured or not running on any node.
If the corresponding lrm_resource element is found, its run state is examined (see the updateRunState function). If the run state is found to be "Running", the name of the current node is returned.
func (*CIB) GetStonithEnabled ¶ added in v0.1.5
func (*CIB) IsStandbyNode ¶ added in v0.1.4
IsStandbyNode check if a node is currently set standby
func (*CIB) ListResourcesOnNode ¶ added in v0.1.6
ListResourcesOnNode lists all resources currently running on the given node
func (*CIB) ReadConfiguration ¶
ReadConfiguration calls the crm list command and parses the XML data it returns.
func (*CIB) SetClusterName ¶ added in v0.1.5
func (*CIB) SetStonithEnabled ¶
func (*CIB) StandbyNode ¶ added in v0.1.3
StandbyNode sets a pacemaker node into standby
func (*CIB) StartResource ¶
func (*CIB) StopResource ¶
func (*CIB) UnStandbyNode ¶ added in v0.1.3
UnStandbyNode sets a pacemaker node out of standby
type ClusterProperty ¶
type ClusterProperty string
const ( StonithEnabled ClusterProperty = "cib-bootstrap-options-stonith-enabled" ClusterName ClusterProperty = "cib-bootstrap-options-cluster-name" )
type LrmRunState ¶
type LrmRunState string
LrmRunState represents the state of a CRM resource.
const ( // Unknown means that the resource's state could not be retrieved Unknown LrmRunState = "Unknown" // Running means that the resource is verified as running Running LrmRunState = "Running" // Stopped means that the resource is verfied as stopped Stopped LrmRunState = "Stopped" )