megaraid

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoController = errors.New("megaraid Controller not found")

ErrNoController - Error reported by Query if no controller is found.

View Source
var ErrNoStorcli = errors.New("no 'storcli' command in PATH")

ErrNoStorcli - Error reported by Query if no storcli binary in PATH

View Source
var ErrUnsupported = errors.New("megaraid Controller unsupported")

ErrUnsupported - Error reported by Query if controller is not supported.

Functions

func IsMegaRaidSysPath

func IsMegaRaidSysPath(syspath string) bool

IsMegaRaidSysPath - is this sys path (udevadm info's DEVPATH) on a megaraid controller.

syspath will look something like
   /devices/pci0000:3a/0000:3a:02.0/0000:3c:00.0/host0/target0:2:2/0:2:2:0/block/sdc

func NameByDiskID

func NameByDiskID(id int) (string, error)

NameByDiskID - return the linux name (sda) for the disk with given DiskID

Types

type Controller

type Controller struct {
	ID          int
	Drives      DriveSet
	DriveGroups DriveGroupSet
	VirtDrives  VirtDriveSet
}

Controller - a Megaraid controller

type Drive

type Drive struct {
	ID         int
	DriveGroup int
	EID        int
	Slot       int
	State      string
	MediaType  MediaType
	Model      string
	Raw        map[string]string
}

Drive - a megaraid (physical) Drive.

func (*Drive) IsEqual

func (d *Drive) IsEqual(d2 Drive) bool

IsEqual - compare the two drives (does not compare Raw)

type DriveGroup

type DriveGroup struct {
	ID     int
	Drives DriveSet
}

DriveGroup - a megaraid "Drive Group". These really have nothing that is their own other than their ID.

func (*DriveGroup) IsSSD

func (dg *DriveGroup) IsSSD() bool

IsSSD - is this drive group composed of all SSD

type DriveGroupSet

type DriveGroupSet map[int]*DriveGroup

DriveGroupSet - map of DriveGroups by their ID

func (DriveGroupSet) MarshalJSON

func (dgs DriveGroupSet) MarshalJSON() ([]byte, error)

MarshalJSON - serialize to json. Custom Marshal to only reference Disks by ID not by full dump.

type DriveSet

type DriveSet map[int]*Drive

DriveSet - just a map of Drives by ID

type MediaType

type MediaType int

MediaType - a disk "Media"

const (
	// UnknownMedia - indicates an unknown media
	UnknownMedia MediaType = iota

	// HDD - Spinning hard disk.
	HDD

	// SSD - Solid State Disk
	SSD
)

func (MediaType) MarshalJSON

func (t MediaType) MarshalJSON() ([]byte, error)

MarshalJSON for string output rather than int

func (MediaType) String

func (t MediaType) String() string

type MegaRaid

type MegaRaid interface {
	// Query - Query the controller provided
	Query(int) (Controller, error)
}

MegaRaid - basic interface

func CachingStorCli

func CachingStorCli() MegaRaid

CachingStorCli - just a cache for a MegaRaid

func StorCli

func StorCli() MegaRaid

StorCli returns a storcli specific implementation of Query

type VirtDrive

type VirtDrive struct {
	// the Virtual Drive Number / ID
	ID int
	// the Drive Group ID
	DriveGroup int
	// Path in linux - may be empty if "Exposed to OS" != "Yes"
	Path string
	// "Name" in output - exposed in cimc UI
	RaidName string
	// Type RAID type (RAID0, RAID1...)
	Type string
	// /c0/v0 data as a string map
	Raw map[string]string
	// "VD0 Properties" as a map
	Properties map[string]string
}

VirtDrive - represents a virtual drive.

type VirtDriveSet

type VirtDriveSet map[int]*VirtDrive

VirtDriveSet - a map of VirtDrives by their Number.

Jump to

Keyboard shortcuts

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