scm

package
v0.0.0-...-d7e8318 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: BSD-2-Clause-Patent Imports: 24 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// FaultUnknown represents an unspecified SCM error.
	FaultUnknown = scmFault(
		code.ScmUnknown, "unknown scm error", "",
	)

	// FaultGetModulesFailed represents an SCM discovery failure.
	FaultGetModulesFailed = scmFault(
		code.ScmDiscoveryFailed, "module discovery failed", "",
	)

	// FaultFormatInvalidSize represents an error where an invalid SCM format size
	// was requested.
	FaultFormatInvalidSize = scmFault(
		code.ScmFormatInvalidSize, "format request must specify a size greater than 0", "",
	)

	// FaultFormatInvalidDeviceCount represents an error where an invalid number
	// of SCM devices was requested during format.
	FaultFormatInvalidDeviceCount = scmFault(
		code.ScmFormatInvalidDeviceCount, "format request must have exactly 1 dcpm device", "",
	)

	// FaultFormatMissingMountpoint represents an error where a mountpoint
	// was missing from an SCM format request.
	FaultFormatMissingMountpoint = scmFault(
		code.ScmFormatMissingMountpoint, "format request must specify mountpoint", "",
	)

	// FaultFormatMissingParam represents an error where a parameter was missing
	// from a format request.
	FaultFormatMissingParam = scmFault(
		code.ScmFormatMissingParam, "format request must have ramdisk or dcpm parameter", "",
	)

	// FaultFormatConflictingParam represents an error where a format request
	// had conflicting parameters.
	FaultFormatConflictingParam = scmFault(
		code.ScmFormatConflictingParam,
		"format request must not have both ramdisk and dcpm parameters", "",
	)

	// FaultFormatNoReformat represents an error where a format was requested
	// on SCM storage that was already formatted.
	FaultFormatNoReformat = scmFault(
		code.StorageAlreadyFormatted,
		"format request for device with an existing filesystem signature",
		"retry the operation with force option to overwrite existing data",
	)

	// FaultDeviceAlreadyMounted represents an error where a format was requested
	// on SCM storage that was already mounted on the system.
	FaultDeviceAlreadyMounted = scmFault(
		code.StorageDeviceAlreadyMounted,
		"request included already-mounted device",
		"unmount the device and retry the operation",
	)

	// FaultMissingNdctl represents an error where the ndctl SCM management tool
	// is not installed on the system.
	FaultMissingNdctl = scmFault(
		code.MissingSoftwareDependency,
		"ndctl utility not found", "install the ndctl software for your OS",
	)

	// FaultDuplicateDevices represents an error where a user provided duplicate
	// device IDs in an input.
	FaultDuplicateDevices = scmFault(code.ScmDuplicatesInDeviceList,
		"duplicates in SCM device list",
		"check your device list and try again")

	// FaultNoFilterMatch represents an error where no modules were found that
	// matched user-provided filter criteria.
	FaultNoFilterMatch = scmFault(code.ScmNoDevicesMatchFilter,
		"no SCM modules matched the filter criteria",
		"adjust or relax the filters and try again")
)

Functions

func FaultFormatMissingDevice

func FaultFormatMissingDevice(device string) *fault.Fault

FaultFormatMissingDevice creates a Fault for the case where a requested device was not found.

func FaultIpmctlBadVersion

func FaultIpmctlBadVersion(version string) *fault.Fault

FaultIpmctlBadVersion represents an error where an incompatible version of ipmctl is installed.

Types

type Backend

type Backend interface {
	GetFirmwareStatus(deviceUID string) (*storage.ScmFirmwareInfo, error)
	UpdateFirmware(deviceUID string, firmwarePath string) error
	// contains filtered or unexported methods
}

Backend defines a set of methods to be implemented by a SCM backend.

type DIMM

type DIMM struct {
	XMLName          xml.Name    `xml:"Dimm",json:"-"`
	ID               hexShort    `xml:"DimmID",json:"dimm_id"`
	Capacity         stringSize  `xml:"Capacity",json:"capacity"`
	HealthState      stringPlain `xml:"HealthState",json:"health_state"`
	FirmwareRevision stringPlain `xml:"FWVersion",json:"fw_version"`
	PhysicalID       hexShort    `xml:"PhysicalID",json:"physical_id"`
	UID              stringPlain `xml:"DimmUID",json:"dimm_uid"`
	SocketID         hexShort    `xml:"SocketID",json:"socket_id"`
	ControllerID     hexShort    `xml:"MemControllerID",json:"mem_controller_id"`
	ChannelID        hexShort    `xml:"ChannelID",json:"channel_id"`
	ChannelPosition  uint32      `xml:"ChannelPos",json:"channel_pos"`
	PartNumber       stringPlain `xml:"PartNumber",json:"part_number"`
}

DIMM struct represents a PMem AppDirect region.

type DIMMList

type DIMMList struct {
	XMLName xml.Name `xml:"DimmList"`
	DIMMs   `xml:"Dimm"`
}

DIMMList struct contains all the PMem DIMMs.

type DIMMs

type DIMMs []DIMM

DIMMs is an alias for a slice of DIMM structs

type MockBackend

type MockBackend struct {
	sync.RWMutex

	PrepareCalls       []storage.ScmPrepareRequest
	ResetCalls         []storage.ScmPrepareRequest
	GetModulesCalls    []int
	GetNamespacesCalls []int
	// contains filtered or unexported fields
}

func DefaultMockBackend

func DefaultMockBackend() *MockBackend

func NewMockBackend

func NewMockBackend(cfg *MockBackendConfig) *MockBackend

func (*MockBackend) GetFirmwareStatus

func (mb *MockBackend) GetFirmwareStatus(deviceUID string) (*storage.ScmFirmwareInfo, error)

func (*MockBackend) UpdateFirmware

func (mb *MockBackend) UpdateFirmware(deviceUID string, firmwarePath string) error

type MockBackendConfig

type MockBackendConfig struct {
	GetModulesRes        storage.ScmModules
	GetModulesErr        error
	GetNamespacesRes     storage.ScmNamespaces
	GetNamespacesErr     error
	PrepRes              *storage.ScmPrepareResponse
	PrepErr              error
	PrepResetRes         *storage.ScmPrepareResponse
	PrepResetErr         error
	GetFirmwareStatusErr error
	GetFirmwareStatusRes *storage.ScmFirmwareInfo
	UpdateFirmwareErr    error
}

MockBackendConfig specifies behavior for a mock SCM backend implementation providing capability to access and configure SCM modules and namespaces.

type NdctlRegion

type NdctlRegion struct {
	Dev               string `json:"dev"`
	Size              uint64 `json:"size"`
	AvailableSize     uint64 `json:"available_size"`
	Align             uint64 `json:"align"`
	NumaNode          uint32 `json:"numa_node"`
	ISetID            uint64 `json:"iset_id"`
	Type              string `json:"type"`
	PersistenceDomain string `json:"persistence_domain"`
}

type NdctlRegions

type NdctlRegions []*NdctlRegion

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider encapsulates configuration and logic for providing SCM management and interrogation.

func DefaultMockProvider

func DefaultMockProvider(log logging.Logger) *Provider

func DefaultProvider

func DefaultProvider(log logging.Logger) *Provider

DefaultProvider returns an initialized *Provider suitable for use with production code.

func NewMockProvider

func NewMockProvider(log logging.Logger, mbc *MockBackendConfig, msc *system.MockSysConfig) *Provider

func NewProvider

func NewProvider(log logging.Logger, backend Backend, sys SystemProvider, mounter storage.MountProvider) *Provider

NewProvider returns an initialized *Provider.

func (*Provider) CheckFormat

CheckFormat attempts to determine whether or not the SCM specified in the request is already formatted. If it is mounted, it is assumed to be formatted. In the case of DCPM, the device is checked directly for the presence of a filesystem.

func (*Provider) Format

Format attempts to fulfill the specified SCM format request.

func (*Provider) IsMounted

func (p *Provider) IsMounted(target string) (bool, error)

IsMounted checks to see if the target device or directory is mounted and returns flag to specify whether mounted or a relevant fault.

func (*Provider) Mount

Mount attempts to mount the target specified in the supplied request.

func (*Provider) Prepare

Prepare attempts to fulfill a SCM Prepare request.

func (*Provider) QueryFirmware

QueryFirmware fetches the status of SCM device firmware.

func (*Provider) Scan

Scan attempts to scan the system for SCM storage components.

func (*Provider) Stat

func (p *Provider) Stat(path string) (os.FileInfo, error)

Stat probes the specified path and returns os level file info.

func (*Provider) Unmount

Unmount attempts to unmount the target specified in the supplied request.

func (*Provider) UpdateFirmware

UpdateFirmware updates the SCM device firmware.

type Region

type Region struct {
	XMLName              xml.Name       `xml:"Region"`
	ID                   regionID       `xml:"RegionID"`
	SocketID             regionSocketID `xml:"SocketID"`
	PersistentMemoryType regionType     `xml:"PersistentMemoryType"`
	Capacity             regionCapacity `xml:"Capacity"`
	FreeCapacity         regionCapacity `xml:"FreeCapacity"`
	Health               regionHealth   `xml:"HealthState"`
	ISetID               regionISetID   `xml:"ISetID"`
}

Region struct represents a PMem AppDirect region.

type RegionList

type RegionList struct {
	XMLName xml.Name `xml:"RegionList"`
	Regions []Region `xml:"Region"`
}

RegionList struct contains all the PMemRegions.

type Regions

type Regions []Region

Regions is an alias for a Region slice.

type SystemProvider

type SystemProvider interface {
	Mkfs(system.MkfsReq) error
	Getfs(device string) (string, error)
	Stat(string) (os.FileInfo, error)
	Chmod(string, os.FileMode) error
	Chown(string, int, int) error
}

SystemProvider defines a set of methods to be implemented by a provider of SCM-specific system capabilities.

Jump to

Keyboard shortcuts

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