detect

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DevicePrefix

func DevicePrefix() string

Types

type Detect

type Detect struct {
	Logger *logrus.Entry
	Config config.Interface
	Shell  shell.Interface
}

func (*Detect) SmartCtlInfo

func (d *Detect) SmartCtlInfo(device *models.Device) error

updates a device model with information from smartctl --scan It has a couple of issues however: - WWN is provided as component data, rather than a "string". We'll have to generate the WWN value ourselves - WWN from smartctl only provided for ATA protocol drives, NVMe and SCSI drives do not include WWN.

func (*Detect) SmartctlScan

func (d *Detect) SmartctlScan() ([]models.Device, error)

This function calls smartctl --scan which can be used to detect storage devices. It has a couple of issues however: - --scan does not return any results on mac

To handle these issues, we have OS specific wrapper functions that update/modify these detected devices. models.Device returned from this function only contain the minimum data for smartctl to execute: device type and device name (device file).

func (*Detect) Start

func (d *Detect) Start() ([]models.Device, error)

func (*Detect) TransformDetectedDevices

func (d *Detect) TransformDetectedDevices(detectedDeviceConns models.Scan) []models.Device

function will remove devices that are marked for "ignore" in config file will also add devices that are specified in config file, but "missing" from smartctl --scan this function will also update the deviceType to the option specified in config.

type Wwn

type Wwn struct {
	Naa        uint64 `json:"naa"`
	Oui        uint64 `json:"oui"`
	Id         uint64 `json:"id"`
	VendorCode string `json:"vendor_code"`
}

func (*Wwn) ToString

func (wwn *Wwn) ToString() string

Jump to

Keyboard shortcuts

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