disks

package
v3.0.0-rc15 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dev

type Dev struct {
	Name   string `json:"name"`
	WWN    string `json:"wwn"`
	Number string `json:"number"`
	Path   string `json:"path"`
	Size   uint64 `json:"size"`
	Vendor string `json:"vendor"`
	Model  string `json:"model"`
	Type   string `json:"type"`
}

Dev is a block device.

func (Dev) Children

func (d Dev) Children() []Dev

func (Dev) HasChildren

func (d Dev) HasChildren() bool

func (Dev) HasParents

func (d Dev) HasParents() bool

func (Dev) IsMpath

func (d Dev) IsMpath() bool

func (Dev) IsMpathPath

func (d Dev) IsMpathPath() bool

func (Dev) Parents

func (d Dev) Parents() []Dev

type DeviceClaims

type DeviceClaims map[string]interface{}

DeviceClaims is a dedup-map indexed by block device path.

func (DeviceClaims) AddPath

func (t DeviceClaims) AddPath(s string)

func (DeviceClaims) AddResource

func (t DeviceClaims) AddResource(r interface{})

type Devices

type Devices map[string]Dev

Devices is a deduplicating map of Dev, indexed by name.

func GetDevices

func GetDevices() (Devices, error)

type Disk

type Disk struct {
	ID      string   `json:"id"`
	DevPath string   `json:"devpath"`
	Size    uint64   `json:"size"`
	Vendor  string   `json:"vendor"`
	Model   string   `json:"model"`
	Type    string   `json:"type"`
	Regions []Region `json:"regions"`
}

Disk is a block device at the bottom of the stacking. Multipath is a special case of stacking: a multipath is a Disk, but not its paths.

func (*Disk) Used

func (d *Disk) Used() (used uint64, err error)

type Disks

type Disks []Disk

func GetDisks

func GetDisks(claims ObjectsDeviceClaims) (Disks, error)

GetDisks return the list of disks visible on the node. Multipath paths are not considered disks.

func (Disks) Render

func (t Disks) Render() string

Render returns a human friendly string representation of the type.

type ObjectsDeviceClaims

type ObjectsDeviceClaims map[string]DeviceClaims

ObjectsDeviceClaims is a map of DeviceClaims indexed by object path. It links objects to block device paths.

func NewObjectsDeviceClaims

func NewObjectsDeviceClaims() ObjectsDeviceClaims

func (ObjectsDeviceClaims) AddObjects

func (t ObjectsDeviceClaims) AddObjects(objs ...interface{})

type Region

type Region struct {
	ID      string `json:"id"`
	DevPath string `json:"devpath"`
	Object  string `json:"object"`
	Size    uint64 `json:"size"`
	Group   string `json:"group"`
}

Region is a Disk part claimed by an object.

type Relation

type Relation struct {
	Child  string
	Parent string
}

Relation links 2 Dev in Parent-Child relationship, in the sense of block device stacking done by drivers such as dm or md. For example:

sda `-sda1 <= child of sda, parent of lv1

`-lv1

type Relations

type Relations map[string]map[string]Relation

func (Relations) LeavesOf

func (t Relations) LeavesOf(parent string) []string

LeavesOf return the device names of block devices at the end of each branch of lsblk, starting at "parent".

Jump to

Keyboard shortcuts

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