zpool

package
v1.11.0-RC1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// PoolOperator is the name of the tool that makes pool-related operations.
	PoolOperator = "zpool"
	// VdevScanProcessedIndex is index of scaned bytes on disk
	VdevScanProcessedIndex = 25
	// VdevScanStatsStateIndex represents the index of dataset scan state
	VdevScanStatsStateIndex = 1
	// VdevScanStatsScanFuncIndex point to index which inform whether device
	// under went resilvering or not
	VdevScanStatsScanFuncIndex = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PoolScanFunc

type PoolScanFunc uint64

PoolScanFunc holds various scanning functions

const (
	// PoolScanFuncNone holds value 0
	PoolScanFuncNone PoolScanFunc = iota
	// PoolScanFuncScrub holds value 1
	PoolScanFuncScrub
	// PoolScanFuncResilver holds value 2 which states device under went resilvering
	PoolScanFuncResilver
	// PoolScanFuncStates holds value 3
	PoolScanFuncStates
)

type PoolScanState

type PoolScanState uint64

PoolScanState states various pool scan states

const (
	// PoolScanNone represents pool scanning is not yet started
	PoolScanNone PoolScanState = iota
	// PoolScanScanning represents pool is undergoing scanning
	PoolScanScanning
	// PoolScanFinished represents pool scanning is finished
	PoolScanFinished
	// PoolScanCanceled represents pool scan is aborted
	PoolScanCanceled
	// PoolScanNumOfStates holds value 4
	PoolScanNumOfStates
)

type Topology

type Topology struct {
	// Number of top-level children in topology (doesnt include spare/l2cache)
	ChildrenCount int `json:"vdev_children,omitempty"`

	// Root of vdev topology
	VdevTree VdevTree `json:"vdev_tree,omitempty"`
}

Topology contains the topology strucure of disks used in backend

func Dump

func Dump() (Topology, error)

Dump runs 'zpool dump' command and unmarshal the output in above schema

type Vdev

type Vdev struct {
	// root for Root vdev, Raid type in case of non-level 0 vdev,
	// and file/disk in case of level-0 vdev
	VdevType string `json:"type,omitempty"`

	// Path of the disk or sparse file
	Path string `json:"path,omitempty"`

	// 0 means not write-cache device, 1 means write-cache device
	IsLog int `json:"is_log,omitempty"`

	// 0 means not spare device, 1 means spare device
	IsSpare int `json:"is_spare,omitempty"`

	// 0 means partitioned disk, 1 means whole disk
	IsWholeDisk int `json:"whole_disk,omitempty"`

	// vdev indetailed statistics
	VdevStats []uint64 `json:"vdev_stats,omitempty"`

	ScanStats []uint64 `json:"scan_stats,omitempty"`

	// child vdevs of the logical disk or null for physical disk/sparse
	Children []Vdev `json:"children,omitempty"`
}

Vdev relates to a logical or physical disk in backend

type VdevList

type VdevList []Vdev

VdevList is alias of list of Vdevs

func (VdevList) GetVdevFromPath

func (l VdevList) GetVdevFromPath(path string) (Vdev, bool)

GetVdevFromPath returns vdev if provided path exists in vdev topology

type VdevTree

type VdevTree struct {
	// root for Root vdev, Raid type in case of non-level 0 vdev,
	// and file/disk in case of level-0 vdev
	VdevType string `json:"type,omitempty"`

	// top-level vdev topology
	Topvdev []Vdev `json:"children,omitempty"`

	// list of read-cache devices
	Readcache []Vdev `json:"l2cache,omitempty"`

	// list of spare devices
	Spares []Vdev `json:"spares,omitempty"`

	// vdev indetailed statistics
	VdevStats []uint64 `json:"vdev_stats,omitempty"`

	// ScanStats states replaced device scan state
	ScanStats []uint64 `json:"scan_stats,omitempty"`
}

VdevTree contains the tree strucure of disks used in backend

Jump to

Keyboard shortcuts

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