storage

package
v0.0.0-...-49abd51 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package storage implements function to work with cros storages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuditStorageSMART

func AuditStorageSMART(ctx context.Context, r components.Runner, storage *tlw.Storage, dut *tlw.Dut) error

AuditStorageSMART checks the storage using it SMART capabilities, and mark the DUT for replacement if needed.

This is a helper function to encapsulate the logic for SMART-check and intended to be called from the exec, as well as any other place where such a check is required.

func CheckBadblocks

func CheckBadblocks(ctx context.Context, bbArgs *BadBlocksArgs) error

CheckBadblocks executes the bad-blocks check on the storage device.

It will also mark the DUT for replacement if required. Any execution of the badblocks command is recorded in Karte using metric kinds backblocks_ro_execution for RO-mode and backblocks_rw_execution for RW-mode check. These Karte metrics are used to decide whether it is time to again run the badblocks command.

func DetectInternalStorage

func DetectInternalStorage(ctx context.Context, run components.Runner) string

DetectInternalStorage detects internal storage based on present fixed disks.

func DeviceMainStoragePath

func DeviceMainStoragePath(ctx context.Context, run components.Runner) (string, error)

DeviceMainStoragePath returns the path of the main storage device on the DUT.

func IsBootedFromExternalStorage

func IsBootedFromExternalStorage(ctx context.Context, run components.Runner) error

IsBootedFromExternalStorage verify that device has been booted from external storage.

func ParseSMARTInfo

func ParseSMARTInfo(ctx context.Context, rawOutput string) (*storageSMART, error)

ParseSMARTInfo reads the storage info from SMART. The info will be located as collection of lines

func RunInstallOSCommand

func RunInstallOSCommand(ctx context.Context, timeout time.Duration, run components.Runner, dst string) error

RunInstallOSCommand run chromeos-install command on the host.

func StorageIssuesExist

func StorageIssuesExist(ctx context.Context, err error) tlw.DutStateReason

StorageIssuesExist checks is error indicate issue with storage.

Types

type AuditMode

type AuditMode string

AuditMode represents the type of audit mode.

type BadBlocksArgs

type BadBlocksArgs struct {
	AuditMode AuditMode
	Run       components.Runner
	Storage   *tlw.Storage
	Dut       *tlw.Dut

	Metrics   metrics.Metrics
	NewMetric func(kind string) *metrics.Action

	TimeoutRW time.Duration
	TimeoutRO time.Duration
}

BadBlocksArgs collects together all the parameters that are applicable for bad blocks execution.

type StorageState

type StorageState string

StorageState is a description of the DUT's storage state given the type of the DUT storage.

const (
	// DUT storage state cannot be determined.
	StorageStateUndefined StorageState = "UNDEFINED"
	// DUT storage state is normal.
	StorageStateNormal StorageState = "NORMAL"
	// DUT storage state is warning.
	StorageStateWarning StorageState = "WARNING"
	// DUT storage state is critical.
	StorageStateCritical StorageState = "CRITICAL"
)

Jump to

Keyboard shortcuts

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