rbmd

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2017 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMounts

func CheckMounts(nodeStat []byte) (bool, []string)

CheckMounts ... Check mounts on down node

func GetRBDPool

func GetRBDPool(device string) (string, string)

GetRBDPool get pool from rbd showmapped

func ParseMountOpts added in v0.0.4

func ParseMountOpts(mountopts string) uintptr

ParseMountOpts parse RBDDevice.Mountopts. Return uintptr

func Run

func Run(zoo Zk, s ServerConf)

Run -- start main loop

func VersionShow

func VersionShow()

VersionShow show version and exit

Types

type ClusterStatus

type ClusterStatus struct {
	Quorum []Node `json:"quorum"`
	Health string `json:"health"`
	Zk     string `json:"zk"`
}

ClusterStatus Quorum status struct

type IPs

type IPs struct {
	V4 []string `json:"v4"`
	V6 []string `json:"v6"`
}

IPs IP addresses

func GetMyIPs

func GetMyIPs() IPs

GetMyIPs Exclude 127.0.0.1

type Mount

type Mount struct {
	Mountpoint string `json:"mountpoint"`
	Mountopts  string `json:"mountopts"`
	Fstype     string `json:"fstype"`
	Pool       string `json:"pool"`
	Image      string `json:"image"`
	Block      string `json:"block"`
}

Mount struct

func GetMounts

func GetMounts() []Mount

GetMounts Parse /proc/mounts and get RBD mounts

type MountState

type MountState struct {
	State   string `json:"state"`
	Message string `json:"message"`
}

MountState status of mount/umount

type Node

type Node struct {
	Node    string  `json:"node"`
	IP      IPs     `json:"ip"`
	Updated int64   `json:"updated"`
	Mounts  []Mount `json:"mounts"`
}

Node Node status struct

func GetNodeState

func GetNodeState(fqdn string) Node

GetNodeState Return Node struct

type Quorum

type Quorum struct {
	Quorum       []Node `json:"quorum"`
	Leader       string `json:"leader"`
	Health       string `json:"health"`
	DeadlyReason Node   `json:"deadlyreason"`
}

Quorum quorum information

type RBDDevice

type RBDDevice struct {
	Node       string `json:"node"`
	Pool       string `json:"pool"`
	Image      string `json:"image"`
	Block      string `json:"block"`
	Mountpoint string `json:"mountpoint"`
	Mountopts  string `json:"mountopts"`
	Fstype     string `json:"fstype"`
}

RBDDevice rbd block device struct

func (RBDDevice) MapDevice

func (r RBDDevice) MapDevice() ([]byte, error)

MapDevice map rbd block device

func (RBDDevice) MountFS

func (r RBDDevice) MountFS(device string) error

MountFS mount file system

func (RBDDevice) UnmapDevice

func (r RBDDevice) UnmapDevice() ([]byte, error)

UnmapDevice unmap rbd block device

func (RBDDevice) UnmountFS

func (r RBDDevice) UnmountFS() error

UnmountFS unmount file system

type Resolve

type Resolve struct {
	Node string `json:"node"`
}

Resolve resolve request

type ServerConf

type ServerConf struct {
	Addr string
	Ws   string
}

ServerConf configuration of http api server

func (ServerConf) ServeHTTP

func (s ServerConf) ServeHTTP(z ZooNode, fqdn string)

ServeHTTP start http server

func (ServerConf) ServeWebSockets

func (s ServerConf) ServeWebSockets(z ZooNode)

ServeWebSockets start websockets server

type Writer

type Writer struct {
	Upgrader websocket.Upgrader
	// contains filtered or unexported fields
}

Writer ws

func (Writer) WriteStatusWs

func (wr Writer) WriteStatusWs(w http.ResponseWriter, r *http.Request)

WriteStatusWs wrtite quorum status to websockets client

type Zk

type Zk struct {
	Hosts []string
	Path  string
	Tick  int
}

Zk Zookeeper connection settings

func (Zk) InitConnection

func (conf Zk) InitConnection() (*zk.Conn, error)

InitConnection Initialize Zookeeper connection

type ZooNode

type ZooNode struct {
	Path string
	Conn *zk.Conn
	Zoo  Zk
}

ZooNode zookeeper node

func (ZooNode) Answer

func (z ZooNode) Answer(fqdn string, req string, stderr []byte, t string)

Answer make answer

func (ZooNode) CheckAndSetHealth

func (z ZooNode) CheckAndSetHealth(childrens []string)

CheckAndSetHealth ...

func (ZooNode) CompareChilds

func (z ZooNode) CompareChilds(node Node) (bool, []string)

CompareChilds return bool Needs rewrite

func (ZooNode) CreateZkTree

func (z ZooNode) CreateZkTree(fqdn string)

CreateZkTree create Zk nodes tree

func (ZooNode) DestroyNode

func (z ZooNode) DestroyNode(fqdn string) ([]string, string)

DestroyNode ... Delete node from quorum

func (ZooNode) EnsureZooPath

func (z ZooNode) EnsureZooPath(node string) (string, error)

EnsureZooPath create zookeeper path

func (ZooNode) FindLeader

func (z ZooNode) FindLeader(fqdn string)

FindLeader return f.q.d.n of current leader

func (ZooNode) GetLeader

func (z ZooNode) GetLeader() string

GetLeader get current leader

func (ZooNode) GetQuorumHealth

func (z ZooNode) GetQuorumHealth() string

GetQuorumHealth return health check of cluster state

func (ZooNode) GetState

func (z ZooNode) GetState() []byte

GetState return cluster status

func (ZooNode) MountRequest

func (z ZooNode) MountRequest(r RBDDevice) error

MountRequest create node with mount requests from API

func (ZooNode) RMR

func (z ZooNode) RMR(path string)

RMR remove Zk node recursive

func (ZooNode) Reconnect

func (z ZooNode) Reconnect()

Reconnect reconnect to Zk

func (ZooNode) RequestWatch

func (z ZooNode) RequestWatch(fqdn string)

RequestWatch watch for mount/umount requests

func (ZooNode) Resolve

func (z ZooNode) Resolve(fqdn string) error

Resolve delete node from quorum

func (ZooNode) ResolveRequest

func (z ZooNode) ResolveRequest(r Resolve) error

ResolveRequest make request for resolve deadly.

func (ZooNode) SetDeadlyReason

func (z ZooNode) SetDeadlyReason(node Node)

SetDeadlyReason default null

func (ZooNode) SetLeader

func (z ZooNode) SetLeader(fqdn string)

SetLeader set current leader

func (ZooNode) SetQuorumHealth

func (z ZooNode) SetQuorumHealth(health string)

SetQuorumHealth set current cluster health

func (ZooNode) UmountRequest

func (z ZooNode) UmountRequest(r RBDDevice) error

UmountRequest create node with umount requests from API OMFG: Needs merge with MountRequest

func (ZooNode) UpdateQuorum

func (z ZooNode) UpdateQuorum(childrens []string)

UpdateQuorum set current cluster state

func (ZooNode) UpdateState

func (z ZooNode) UpdateState(zkPath string, fqdn string)

UpdateState -- update node status

func (ZooNode) WatchAnswer

func (z ZooNode) WatchAnswer(fqdn string, t string) MountState

WatchAnswer watch for answer

Jump to

Keyboard shortcuts

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