Documentation
¶
Overview ¶
Package spdk provides Go bindings for SPDK
Package spdk provides Go bindings for SPDK
Index ¶
- Constants
- Variables
- func FaultBindingFailed(rc int, msg string) *fault.Fault
- func FaultBindingRetNull(msg string) *fault.Fault
- type Env
- type EnvImpl
- type EnvOptions
- type FormatResult
- type LockfileAddrCheckFn
- type MockEnvCfg
- type MockEnvImpl
- type MockNvmeCfg
- type MockNvmeImpl
- func (n MockNvmeImpl) Clean(log logging.Logger, pciAddrChecker LockfileAddrCheckFn) ([]string, error)
- func (n MockNvmeImpl) Discover(log logging.Logger) (storage.NvmeControllers, error)
- func (n MockNvmeImpl) Format(log logging.Logger) ([]*FormatResult, error)
- func (n MockNvmeImpl) Update(log logging.Logger, ctrlrPciAddr string, path string, slot int32) error
- type Nvme
- type NvmeImpl
- func (n *NvmeImpl) Clean(log logging.Logger, pciAddrChecker LockfileAddrCheckFn) ([]string, error)
- func (n *NvmeImpl) Discover(log logging.Logger) (storage.NvmeControllers, error)
- func (n *NvmeImpl) Format(log logging.Logger) ([]*FormatResult, error)
- func (n *NvmeImpl) Update(log logging.Logger, ctrlrPciAddr string, path string, slot int32) error
Constants ¶
const LockfilePrefix = "spdk_pci_lock_"
Static prefix for SPDK generated lockfiles.
Variables ¶
var ( FaultUnknown = spdkFault( code.SpdkUnknown, "unknown SPDK bindings error", "", ) FaultCtrlrNoHealth = spdkFault( code.SpdkCtrlrNoHealth, "NVMe controller details are missing health statistics", "", ) )
Functions ¶
func FaultBindingRetNull ¶
Types ¶
type Env ¶
type Env interface {
InitSPDKEnv(logging.Logger, *EnvOptions) error
FiniSPDKEnv(logging.Logger, *EnvOptions)
}
Env is the interface that provides SPDK environment management.
type EnvImpl ¶
type EnvImpl struct{}
EnvImpl is a an implementation of the Env interface.
func NewEnvImpl ¶
func NewEnvImpl() *EnvImpl
NewEnvImpl is a constructor for the EnvImpl implementation of the Env interface.
func (*EnvImpl) FiniSPDKEnv ¶
func (ei *EnvImpl) FiniSPDKEnv(log logging.Logger, opts *EnvOptions)
FiniSPDKEnv initializes the SPDK environment.
func (*EnvImpl) InitSPDKEnv ¶
func (ei *EnvImpl) InitSPDKEnv(log logging.Logger, opts *EnvOptions) error
InitSPDKEnv initializes the SPDK environment.
type EnvOptions ¶
type EnvOptions struct {
PCIAllowList *hardware.PCIAddressSet // restrict SPDK device access
EnableVMD bool // flag if VMD functionality should be enabled
}
EnvOptions describe parameters to be used when initializing a processes SPDK environment.
type FormatResult ¶
FormatResult struct mirrors C.struct_wipe_res_t and describes the results of a format operation on an NVMe controller namespace.
type LockfileAddrCheckFn ¶
LockfileAddrCheckFn is a function supplied to the Clean API call which can be used to decide whether to remove a lockfile for device or not based on its PCI address. This is necessary so that logic outside of this package can be used to determine which addresses to process.
type MockEnvCfg ¶
type MockEnvCfg struct {
InitErr error
}
MockEnvCfg controls the behavior of the MockEnvImpl.
type MockEnvImpl ¶
type MockEnvImpl struct {
sync.RWMutex
Cfg MockEnvCfg
InitCalls []*EnvOptions
FiniCalls []*EnvOptions
}
MockEnvImpl is a mock implementation of the Env interface.
func (*MockEnvImpl) FiniSPDKEnv ¶
func (e *MockEnvImpl) FiniSPDKEnv(log logging.Logger, opts *EnvOptions)
FiniSPDKEnv finalizes the SPDK environment.
func (*MockEnvImpl) InitSPDKEnv ¶
func (e *MockEnvImpl) InitSPDKEnv(log logging.Logger, opts *EnvOptions) error
InitSPDKEnv initializes the SPDK environment.
type MockNvmeCfg ¶
type MockNvmeCfg struct {
DiscoverCtrlrs storage.NvmeControllers
DiscoverErr error
FormatRes []*FormatResult
FormatErr error
UpdateErr error
CleanErr error
CleanRes []string
}
MockNvmeCfg controls the behavior of the MockNvmeImpl.
type MockNvmeImpl ¶
type MockNvmeImpl struct {
Cfg MockNvmeCfg
}
MockNvmeImpl is an implementation of the Nvme interface.
func (MockNvmeImpl) Clean ¶
func (n MockNvmeImpl) Clean(log logging.Logger, pciAddrChecker LockfileAddrCheckFn) ([]string, error)
Clean removes SPDK lockfiles associated with NVMe SSDs/controllers at given PCI addresses.
func (MockNvmeImpl) Discover ¶
func (n MockNvmeImpl) Discover(log logging.Logger) (storage.NvmeControllers, error)
Discover NVMe devices, including NVMe devices behind VMDs if enabled, accessible by SPDK on a given host.
func (MockNvmeImpl) Format ¶
func (n MockNvmeImpl) Format(log logging.Logger) ([]*FormatResult, error)
Format device at given pci address, destructive operation!
type Nvme ¶
type Nvme interface {
// Discover NVMe controllers and namespaces, and device health info
Discover(logging.Logger) (storage.NvmeControllers, error)
// Format NVMe controller namespaces
Format(logging.Logger) ([]*FormatResult, error)
// Update updates the firmware on a specific PCI address and slot
Update(log logging.Logger, ctrlrPciAddr string, path string, slot int32) error
// Clean removes lockfiles associated with NVMe controllers. Decisions regarding which
// lockfiles to remove made using supplied address check function.
Clean(logging.Logger, LockfileAddrCheckFn) ([]string, error)
}
Nvme is the interface that provides SPDK NVMe functionality.
type NvmeImpl ¶
type NvmeImpl struct {
LocksDir string
}
NvmeImpl is an implementation of the Nvme interface.
func NewNvmeImpl ¶
func NewNvmeImpl() *NvmeImpl
NewNvmeImpl is a constructor for the NvmeImpl implementation of the Nvme interface.