engine

package
v0.0.0-...-48f4461 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: BSD-2-Clause-Patent Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NvmeMinBytesPerTarget is min NVMe pool allocation per target
	NvmeMinBytesPerTarget = 1 * humanize.GiByte
	// ScmMinBytesPerTarget is min SCM pool allocation per target
	ScmMinBytesPerTarget = 16 * humanize.MiByte
)
View Source
const (

	// MultiProviderSeparator delineates between providers in a multi-provider config.
	MultiProviderSeparator = ","
)

Variables

This section is empty.

Functions

func IsNUMAMismatch

func IsNUMAMismatch(err error) bool

IsNUMAMismatch returns true if the supplied error is the result of a NUMA node configuration error.

func MergeLogEnvVars

func MergeLogEnvVars(logMasks, subsystemsStr string) (string, error)

MergeLogEnvVars merges the value of DD_SUBSYS into D_LOG_MASK. The function takes original D_LOG_MASK and DD_SUBSYS values and returns resultant log_mask. The merge is performed by evaluating DD_SUBSYS list of subsystems to be enabled and appending subsystem log level assignments to D_LOG_MASK list when appropriate.

1. Return D_LOG_MASK if DD_SUBSYS or D_LOG_MASK are unset 2. Identify original base log level from D_LOG_MASK 3. Enumerate subsystem level assignments from D_LOG_MASK. 4. Remove assignments if level < ERROR and subsystem not in subsystems slice. Log a warning. 5. Add assignments if base level < ERROR and subsystem in subsystems slice. 6. Remove any assignment where level is equal to the new base level. 7. Return new log masks generated from assignments and the new base level.

func ValidateLogMasks

func ValidateLogMasks(masks string) error

ValidateLogMasks provides validation for log-masks string specifier.

The input string should look like: PREFIX1=LEVEL1,PREFIX2=LEVEL2,... LEVELs are validated here whilst PREFIX (subsystem) is validated server side.

func ValidateLogStreams

func ValidateLogStreams(streams string) error

ValidateLogStreams provides validation for the stream names provided in the log-masks debug streams string. The input string should look like: STREAM1,STREAM2,...

func ValidateLogSubsystems

func ValidateLogSubsystems(subsystems string) error

ValidateLogSubsystems provides validation for the subsystem names provided in the string. The input string should look like: SUBSYS1,SUBSYS2,...

Types

type Config

type Config struct {
	Modules           string         `yaml:"modules,omitempty" cmdLongFlag:"--modules" cmdShortFlag:"-m"`
	TargetCount       int            `yaml:"targets,omitempty" cmdLongFlag:"--targets,nonzero" cmdShortFlag:"-t,nonzero"`
	HelperStreamCount int            `yaml:"nr_xs_helpers" cmdLongFlag:"--xshelpernr" cmdShortFlag:"-x"`
	ServiceThreadCore *int           `yaml:"first_core,omitempty" cmdLongFlag:"--firstcore" cmdShortFlag:"-f"`
	SystemName        string         `yaml:"-" cmdLongFlag:"--group" cmdShortFlag:"-g"`
	SocketDir         string         `yaml:"-" cmdLongFlag:"--socket_dir" cmdShortFlag:"-d"`
	LogMask           string         `yaml:"log_mask,omitempty" cmdEnv:"D_LOG_MASK"`
	LogFile           string         `yaml:"log_file,omitempty" cmdEnv:"D_LOG_FILE"`
	Storage           storage.Config `yaml:",inline,omitempty"`
	Fabric            FabricConfig   `yaml:",inline"`
	EnvVars           []string       `yaml:"env_vars,omitempty"`
	EnvPassThrough    []string       `yaml:"env_pass_through,omitempty"`
	PinnedNumaNode    *uint          `yaml:"pinned_numa_node,omitempty" cmdLongFlag:"--pinned_numa_node" cmdShortFlag:"-p"`
	Index             uint32         `yaml:"-" cmdLongFlag:"--instance_idx" cmdShortFlag:"-I"`
	MemSize           int            `yaml:"-" cmdLongFlag:"--mem_size" cmdShortFlag:"-r"`
	HugepageSz        int            `yaml:"-" cmdLongFlag:"--hugepage_size" cmdShortFlag:"-H"`
	CheckerEnabled    bool           `yaml:"-" cmdLongFlag:"--checker" cmdShortFlag:"-C"`
}

Config encapsulates an I/O Engine's configuration.

func MockConfig

func MockConfig() *Config

MockConfig returns an I/O Engine config set up for testing.

func NewConfig

func NewConfig() *Config

NewConfig returns an I/O Engine config.

func (*Config) AppendStorage

func (c *Config) AppendStorage(cfgs ...*storage.TierConfig) *Config

AppendStorage appends the given storage tier configurations to the existing set of storage configs.

func (*Config) CmdLineArgs

func (c *Config) CmdLineArgs() ([]string, error)

CmdLineArgs returns a slice of command line arguments to be supplied when starting an I/O Engine instance.

func (*Config) CmdLineEnv

func (c *Config) CmdLineEnv() ([]string, error)

CmdLineEnv returns a slice of environment variables to be supplied when starting an I/O Engine instance.

func (*Config) GetEnvVar

func (c *Config) GetEnvVar(name string) (string, error)

GetEnvVar returns the value of the given environment variable to be supplied when starting an I/O engine instance.

func (*Config) HasEnvVar

func (c *Config) HasEnvVar(name string) bool

HasEnvVar returns true if the configuration contains an environment variable with the given name.

func (*Config) ReadLogDbgStreams

func (c *Config) ReadLogDbgStreams() (string, error)

ReadLogDbgStreams extracts the value of DD_MASK from engine config env_vars.

func (*Config) ReadLogSubsystems

func (c *Config) ReadLogSubsystems() (string, error)

ReadLogSubsystems extracts the value of DD_SUBSYS from engine config env_vars.

func (*Config) SetNUMAAffinity

func (c *Config) SetNUMAAffinity(node uint) error

SetNUMAAffinity sets the NUMA affinity for the engine, if not already set in the configuration.

func (*Config) UpdatePMDKEnvars

func (c *Config) UpdatePMDKEnvars() error

Ensure proper environment variables for PMDK w/ NDCTL enabled based on the actual configuration of the storage class.

func (*Config) UpdatePMDKEnvarsPMemobjConf

func (c *Config) UpdatePMDKEnvarsPMemobjConf(isDCPM bool) error

Ensure proper configuration of shutdown (SDS) state

func (*Config) UpdatePMDKEnvarsStackSizeDCPM

func (c *Config) UpdatePMDKEnvarsStackSizeDCPM() error

Ensure at least 20KiB ABT stack size for an engine with DCPM storage class.

func (*Config) Validate

func (c *Config) Validate() error

Validate ensures that the configuration meets minimum standards.

func (*Config) WithBypassHealthChk

func (c *Config) WithBypassHealthChk(bypass *bool) *Config

WithBypassHealthChk sets the NVME health check bypass for this instance

func (*Config) WithCrtTimeout

func (c *Config) WithCrtTimeout(timeout uint32) *Config

WithCrtTimeout defines the CRT_TIMEOUT for this instance

func (*Config) WithEnvPassThrough

func (c *Config) WithEnvPassThrough(allowList ...string) *Config

WithEnvPassThrough sets a list of environment variable names that will be allowed to pass through into the engine subprocess environment.

func (*Config) WithEnvVarAbtThreadStackSize

func (c *Config) WithEnvVarAbtThreadStackSize(stack_size uint16) *Config

WithEnvVarAbtThreadStackSize sets environment variable ABT_THREAD_STACKSIZE.

func (*Config) WithEnvVarPMemObjSdsAtCreate

func (c *Config) WithEnvVarPMemObjSdsAtCreate(value uint8) *Config

WithEnvVarPMemObjSdsAtCreate sets PMEMOBJ_CONF env. var. to sds.at_create=0/1 value

func (*Config) WithEnvVars

func (c *Config) WithEnvVars(newVars ...string) *Config

WithEnvVars applies the supplied list of environment variables to any existing variables, with new values overwriting existing values.

func (*Config) WithFabricAuthKey

func (c *Config) WithFabricAuthKey(key string) *Config

WithFabricAuthKey sets the fabric authorization key.

func (*Config) WithFabricInterface

func (c *Config) WithFabricInterface(iface string) *Config

WithFabricInterface sets the interface name to be used by this instance.

func (*Config) WithFabricInterfacePort

func (c *Config) WithFabricInterfacePort(ifacePort int) *Config

WithFabricInterfacePort sets the numeric interface port to be used by this instance.

func (*Config) WithFabricNumaNodeIndex

func (c *Config) WithFabricNumaNodeIndex(nodeIndex uint) *Config

WithFabricNumaNodeIndex sets the NUMA node index to be used by this instance.

func (*Config) WithFabricProvider

func (c *Config) WithFabricProvider(provider string) *Config

WithFabricProvider sets the name of the CArT fabric provider.

func (*Config) WithHelperStreamCount

func (c *Config) WithHelperStreamCount(count int) *Config

WithHelperStreamCount sets the number of XS Helper streams to run on this instance.

func (*Config) WithHugepageSize

func (c *Config) WithHugepageSize(hugepagesz int) *Config

WithHugepageSize sets the configured hugepage size on this instance.

func (*Config) WithIndex

func (c *Config) WithIndex(i uint32) *Config

WithIndex sets the I/O Engine instance index.

func (*Config) WithLogFile

func (c *Config) WithLogFile(logPath string) *Config

WithLogFile sets the path to the log file to be used by this instance.

func (*Config) WithLogMask

func (c *Config) WithLogMask(logMask string) *Config

WithLogMask sets the DAOS logging mask to be used by this instance.

func (*Config) WithLogStreams

func (c *Config) WithLogStreams(streams string) *Config

WithLogStreams sets the DAOS logging debug streams to be used by this instance.

func (*Config) WithLogSubsystems

func (c *Config) WithLogSubsystems(subsystems string) *Config

WithLogSubsystems sets the DAOS logging subsystems to be used by this instance.

func (*Config) WithMemSize

func (c *Config) WithMemSize(memsize int) *Config

WithMemSize sets the NVMe memory size for SPDK memory allocation on this instance.

func (*Config) WithModules

func (c *Config) WithModules(mList string) *Config

WithModules sets the list of I/O Engine modules to be loaded.

func (*Config) WithNumSecondaryEndpoints

func (c *Config) WithNumSecondaryEndpoints(nr []int) *Config

WithNumSecondaryEndpoints sets the number of network endpoints for each secondary provider.

func (*Config) WithPinnedNumaNode

func (c *Config) WithPinnedNumaNode(numa uint) *Config

WithPinnedNumaNode sets the NUMA node affinity for the I/O Engine instance.

func (*Config) WithServiceThreadCore

func (c *Config) WithServiceThreadCore(idx int) *Config

WithServiceThreadCore sets the core index to be used for running DAOS service threads.

func (*Config) WithSocketDir

func (c *Config) WithSocketDir(dir string) *Config

WithSocketDir sets the path to the instance's dRPC socket directory.

func (*Config) WithSrxDisabled

func (c *Config) WithSrxDisabled(disable bool) *Config

WithSrxDisabled disables or enables SRX.

func (*Config) WithStorage

func (c *Config) WithStorage(cfgs ...*storage.TierConfig) *Config

WithStorage creates the set of storage tier configurations. Note that this method replaces any existing configs. To append, use AppendStorage().

func (*Config) WithStorageAccelProps

func (c *Config) WithStorageAccelProps(name string, mask storage.AccelOptionBits) *Config

WithStorageAccelProps sets the acceleration properties for the I/O Engine instance.

func (*Config) WithStorageAutoFaultyCriteria

func (c *Config) WithStorageAutoFaultyCriteria(enable bool, maxIoErrs, maxCsumErrs uint32) *Config

WithStorageAutoFaultyCriteria specifies NVMe auto-faulty settings in the I/O Engine.

func (*Config) WithStorageConfigOutputPath

func (c *Config) WithStorageConfigOutputPath(cfgPath string) *Config

WithStorageConfigOutputPath sets the path to the generated NVMe config file used by SPDK.

func (*Config) WithStorageControlMetadataDevice

func (c *Config) WithStorageControlMetadataDevice(device string) *Config

WithStorageControlMetadataDevice sets the metadata device to be used by this instance.

func (*Config) WithStorageControlMetadataPath

func (c *Config) WithStorageControlMetadataPath(path string) *Config

WithStorageControlMetadataPath sets the metadata path to be used by this instance.

func (*Config) WithStorageEnableHotplug

func (c *Config) WithStorageEnableHotplug(enable bool) *Config

WithStorageEnableHotplug sets EnableHotplug in engine storage.

func (*Config) WithStorageIndex

func (c *Config) WithStorageIndex(i uint32) *Config

WithStorageIndex sets the I/O Engine instance index in the storage struct.

func (*Config) WithStorageNumaNodeIndex

func (c *Config) WithStorageNumaNodeIndex(nodeIndex uint) *Config

WithStorageNumaNodeIndex sets the NUMA node index to be used by this instance.

func (*Config) WithStorageSpdkRpcSrvProps

func (c *Config) WithStorageSpdkRpcSrvProps(enable bool, sockAddr string) *Config

WithStorageSpdkRpcSrvProps specifies whether a SPDK JSON-RPC server will run in the I/O Engine.

func (*Config) WithStorageVosEnv

func (c *Config) WithStorageVosEnv(ve string) *Config

WithStorageVosEnv sets the VOS_BDEV_CLASS env variable.

func (*Config) WithSystemName

func (c *Config) WithSystemName(name string) *Config

WithSystemName sets the system name to which the instance belongs.

func (*Config) WithTargetCount

func (c *Config) WithTargetCount(count int) *Config

WithTargetCount sets the number of VOS targets to run on this instance.

type FabricConfig

type FabricConfig struct {
	Provider        string `yaml:"provider,omitempty" cmdEnv:"D_PROVIDER"`
	Interface       string `yaml:"fabric_iface,omitempty" cmdEnv:"D_INTERFACE"`
	InterfacePort   int    `yaml:"fabric_iface_port,omitempty" cmdEnv:"D_PORT,nonzero"`
	NumaNodeIndex   uint   `yaml:"-"`
	BypassHealthChk *bool  `yaml:"bypass_health_chk,omitempty" cmdLongFlag:"--bypass_health_chk" cmdShortFlag:"-b"`
	CrtTimeout      uint32 `yaml:"crt_timeout,omitempty" cmdEnv:"CRT_TIMEOUT"`
	// NumSecondaryEndpoints configures the number of cart endpoints per secondary provider.
	NumSecondaryEndpoints []int  `yaml:"secondary_provider_endpoints,omitempty" cmdLongFlag:"--nr_sec_ctx,nonzero" cmdShortFlag:"-S,nonzero"`
	DisableSRX            bool   `yaml:"disable_srx,omitempty" cmdEnv:"FI_OFI_RXM_USE_SRX,invertBool,intBool"`
	AuthKey               string `yaml:"fabric_auth_key,omitempty" cmdEnv:"D_PROVIDER_AUTH_KEY"`
}

FabricConfig encapsulates networking fabric configuration.

func (*FabricConfig) GetAuthKeyEnv

func (fc *FabricConfig) GetAuthKeyEnv() string

GetAuthKeyEnv returns the environment variable string for the auth key.

func (*FabricConfig) GetInterfacePorts

func (fc *FabricConfig) GetInterfacePorts() ([]int, error)

GetInterfacePorts parses the InterfacePort string to one or more ports.

func (*FabricConfig) GetInterfaces

func (fc *FabricConfig) GetInterfaces() ([]string, error)

GetInterfaces parses the Interface string into one or more interfaces.

func (*FabricConfig) GetNumProviders

func (fc *FabricConfig) GetNumProviders() int

GetNumProviders gets the number of fabric providers configured.

func (*FabricConfig) GetPrimaryInterface

func (fc *FabricConfig) GetPrimaryInterface() (string, error)

GetPrimaryInterface parses the primary fabric interface from the Interface string.

func (*FabricConfig) GetPrimaryProvider

func (fc *FabricConfig) GetPrimaryProvider() (string, error)

GetPrimaryProvider parses the primary provider from the Provider string.

func (*FabricConfig) GetProviders

func (fc *FabricConfig) GetProviders() ([]string, error)

GetProviders parses the Provider string to one or more providers.

func (*FabricConfig) Update

func (fc *FabricConfig) Update(other FabricConfig)

Update fills in any missing fields from the provided FabricConfig.

func (*FabricConfig) Validate

func (fc *FabricConfig) Validate() error

Validate ensures that the configuration meets minimum standards.

type LogLevel

type LogLevel uint

LogLevel enum representing engine logging levels.

const (
	LogLevelUndefined LogLevel = iota
	LogLevelDbug
	LogLevelInfo
	LogLevelNote
	LogLevelWarn
	LogLevelErr
	LogLevelCrit
	LogLevelAlrt
	LogLevelEmrg
	LogLevelEmit
)

LogLevels matching D_LOG API priority strings.

func StrToLogLevel

func StrToLogLevel(s string) LogLevel

StrToLogLevel takes an input string and returns a LogLevel type object.

func (LogLevel) String

func (ll LogLevel) String() string

type Runner

type Runner struct {
	Config *Config
	// contains filtered or unexported fields
}

Runner starts and manages an instance of a DAOS I/O Engine

func NewRunner

func NewRunner(log logging.Logger, config *Config) *Runner

NewRunner returns a configured engine.Runner

func (*Runner) GetConfig

func (r *Runner) GetConfig() *Config

GetConfig returns the runner's configuration

func (*Runner) IsRunning

func (r *Runner) IsRunning() bool

IsRunning indicates whether the Runner process is running or not.

func (*Runner) Signal

func (r *Runner) Signal(signal os.Signal)

Signal sends relevant signal to the Runner process (idempotent).

func (*Runner) Start

func (r *Runner) Start(ctx context.Context) (RunnerExitChan, error)

Start asynchronously starts the Engine instance.

type RunnerExitChan

type RunnerExitChan chan *RunnerExitInfo

type RunnerExitInfo

type RunnerExitInfo struct {
	Error error
	PID   int
}

type TestRunner

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

func NewTestRunner

func NewTestRunner(trc *TestRunnerConfig, sc *Config) *TestRunner

func (*TestRunner) GetConfig

func (tr *TestRunner) GetConfig() *Config

func (*TestRunner) GetLastPid

func (tr *TestRunner) GetLastPid() uint64

func (*TestRunner) GetRunnerConfig

func (tr *TestRunner) GetRunnerConfig() *TestRunnerConfig

func (*TestRunner) IsRunning

func (tr *TestRunner) IsRunning() bool

func (*TestRunner) Signal

func (tr *TestRunner) Signal(sig os.Signal)

func (*TestRunner) Start

func (tr *TestRunner) Start(ctx context.Context) (RunnerExitChan, error)

type TestRunnerConfig

type TestRunnerConfig struct {
	StartCb          func()
	StartErr         error
	Running          atm.Bool
	SignalCb         func(uint32, os.Signal)
	LastPid          uint64
	RunnerExitInfoCb func(context.Context) *RunnerExitInfo
	RunnerExitInfo   *RunnerExitInfo
}

Jump to

Keyboard shortcuts

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