Documentation
¶
Overview ¶
Package storage implements function to work with cros storages.
Index ¶
- func AuditStorageSMART(ctx context.Context, r components.Runner, storage *tlw.Storage, dut *tlw.Dut) error
- func CheckBadblocks(ctx context.Context, bbArgs *BadBlocksArgs) error
- func DetectInternalStorage(ctx context.Context, run components.Runner) string
- func DeviceMainStoragePath(ctx context.Context, run components.Runner) (string, error)
- func IsBootedFromExternalStorage(ctx context.Context, run components.Runner) error
- func ParseSMARTInfo(ctx context.Context, rawOutput string) (*storageSMART, error)
- func RunInstallOSCommand(ctx context.Context, timeout time.Duration, run components.Runner, dst string) error
- func StorageIssuesExist(ctx context.Context, err error) tlw.DutStateReason
- type AuditMode
- type BadBlocksArgs
- type StorageState
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 ¶
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 ¶
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 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" )