config

package
v0.0.0-...-90852a8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: BSD-2-Clause-Patent Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigOut = ".daos_server.active.yml"
)

Variables

View Source
var (
	FaultUnknown = serverConfigFault(
		code.ServerConfigUnknown,
		"unknown control server error",
		"",
	)
	FaultBadConfig = serverConfigFault(
		code.ServerBadConfig,
		"insufficient information in configuration",
		"supply path to valid configuration file, use examples for reference",
	)
	FaultConfigNoPath = serverConfigFault(
		code.ServerNoConfigPath,
		"configuration file path not set",
		"supply the path to a server configuration file when restarting the control server with commandline option '-o'",
	)
	FaultConfigBadControlPort = serverConfigFault(
		code.ServerConfigBadControlPort,
		"invalid control port in configuration",
		"specify a positive non-zero network port in configuration ('port' parameter) and restart the control server",
	)
	FaultConfigBadTelemetryPort = serverConfigFault(
		code.ServerConfigBadTelemetryPort,
		"invalid telemetry port in configuration",
		"specify a positive non-zero network port in configuration ('telemetry_port' parameter) and restart the control server",
	)
	FaultConfigBadAccessPoints = serverConfigFault(
		code.ServerConfigBadAccessPoints,
		"invalid list of access points in configuration",
		"'access_points' must contain resolvable addresses; fix the configuration and restart the control server",
	)
	FaultConfigEvenAccessPoints = serverConfigFault(
		code.ServerConfigEvenAccessPoints,
		"non-odd number of access points in configuration",
		"'access_points' must contain an odd number (e.g. 1, 3, 5, etc.) of addresses; fix the configuration and restart the control server",
	)
	FaultConfigNoProvider = serverConfigFault(
		code.ServerConfigBadProvider,
		"provider not specified in server configuration",
		"specify a valid network provider in configuration ('provider' parameter) and restart the control server",
	)
	FaultConfigNoEngines = serverConfigFault(
		code.ServerConfigNoEngines,
		"no DAOS IO Engines specified in configuration",
		"specify at least one IO Engine configuration ('engines' list parameter) and restart the control server",
	)
	FaultConfigFaultDomainInvalid = serverConfigFault(
		code.ServerConfigFaultDomainInvalid,
		"invalid fault domain",
		"specify a valid fault domain ('fault_path' parameter) or callback script ('fault_cb' parameter) and restart the control server",
	)
	FaultConfigFaultCallbackNotFound = serverConfigFault(
		code.ServerConfigFaultCallbackNotFound,
		"fault domain callback script not found",
		"specify a valid fault domain callback script ('fault_cb' parameter) and restart the control server",
	)
	FaultConfigFaultCallbackBadPerms = serverConfigFault(
		code.ServerConfigFaultCallbackBadPerms,
		"fault domain callback cannot be executed",
		"ensure that permissions for the DAOS server user are properly set on the fault domain callback script ('fault_cb' parameter) and restart the control server",
	)
	FaultConfigBothFaultPathAndCb = serverConfigFault(
		code.ServerConfigBothFaultPathAndCb,
		"both fault domain and fault path are defined in the configuration",
		"remove either the fault domain ('fault_path' parameter) or callback script ('fault_cb' parameter) and restart the control server",
	)
	FaultConfigFaultCallbackEmpty = serverConfigFault(
		code.ServerConfigFaultCallbackEmpty,
		"fault domain callback executed but did not generate output",
		"specify a valid fault domain callback script ('fault_cb' parameter) and restart the control server",
	)
	FaultConfigTooManyLayersInFaultDomain = serverConfigFault(
		code.ServerConfigFaultDomainTooManyLayers,
		"the fault domain path may have a maximum of 2 levels below the root",
		"update either the fault domain ('fault_path' parameter) or callback script ('fault_cb' parameter) and restart the control server",
	)
	FaultConfigHugepagesDisabledWithBdevs = serverConfigFault(
		code.ServerConfigHugepagesDisabledWithBdevs,
		"hugepages cannot be disabled if bdevs have been specified in config",
		"either set false (or remove) disable_hugepages parameter or remove nvme storage assignment in config and restart the control server",
	)
	FaultConfigVMDSettingDuplicate = serverConfigFault(
		code.ServerConfigVMDSettingDuplicate,
		"enable_vmd and disable_vmd parameters both specified in config",
		"remove legacy enable_vmd parameter from config",
	)
	FaultConfigControlMetadataNoPath = serverConfigFault(
		code.ServerConfigControlMetadataNoPath,
		"using a control_metadata device requires a path to use as the mount point",
		"add a valid 'path' to the 'control_metadata' section of the config",
	)
	FaultConfigEngineBdevRolesMismatch = serverConfigFault(
		code.ServerConfigEngineBdevRolesMismatch,
		"md-on-ssd bdev roles have been set in some but not all engine configs",
		"set bdev roles on all engines or remove all bdev role assignments in config",
	)
	FaultConfigSysRsvdZero = serverConfigFault(
		code.ServerConfigSysRsvdZero,
		"`system_ram_reserved` is set to zero in server config",
		"set `system_ram_reserved` to a positive integer value in config",
	)
)
View Source
var (
	// ErrNoAffinityDetected is a sentinel error used to indicate that no affinity was detected.
	ErrNoAffinityDetected = errors.New("no NUMA affinity detected")
)

Functions

func FaultConfigBdevCountMismatch

func FaultConfigBdevCountMismatch(curIdx, curCount, seenIdx, seenCount int) *fault.Fault

func FaultConfigDuplicateFabric

func FaultConfigDuplicateFabric(curIdx, seenIdx int) *fault.Fault

func FaultConfigDuplicateLogFile

func FaultConfigDuplicateLogFile(curIdx, seenIdx int) *fault.Fault

func FaultConfigDuplicateScmDeviceList

func FaultConfigDuplicateScmDeviceList(curIdx, seenIdx int) *fault.Fault

func FaultConfigDuplicateScmMount

func FaultConfigDuplicateScmMount(curIdx, seenIdx int) *fault.Fault

func FaultConfigFaultCallbackFailed

func FaultConfigFaultCallbackFailed(err error) *fault.Fault

FaultConfigFaultCallbackFailed creates a Fault for the scenario where the fault domain callback failed with some error.

func FaultConfigFaultCallbackInsecure

func FaultConfigFaultCallbackInsecure(requiredDir string) *fault.Fault

FaultConfigFaultCallbackInsecure creates a fault for the scenario where the fault domain callback path doesn't meet security requirements.

func FaultConfigHelperStreamCountMismatch

func FaultConfigHelperStreamCountMismatch(curIdx, curCount, seenIdx, seenCount int) *fault.Fault

func FaultConfigInvalidNetDevClass

func FaultConfigInvalidNetDevClass(curIdx int, primaryDevClass, thisDevClass hardware.NetDevClass, iface string) *fault.Fault

func FaultConfigNrHugepagesOutOfRange

func FaultConfigNrHugepagesOutOfRange(req, max int) *fault.Fault

FaultConfigNrHugepagesOutOfRange creates a fault for the scenario where the number of configured huge pages is smaller than zero or larger than the maximum value allowed.

func FaultConfigOverlappingBdevDeviceList

func FaultConfigOverlappingBdevDeviceList(curIdx, seenIdx int) *fault.Fault

func FaultConfigRamdiskOverMaxMem

func FaultConfigRamdiskOverMaxMem(confSize, ramSize, memRamdiskMin uint64) *fault.Fault

FaultConfigRamdiskOverMaxMem indicates that the tmpfs size requested in config is larger than maximum allowed.

func FaultConfigScmDiffClass

func FaultConfigScmDiffClass(curIdx, seenIdx int) *fault.Fault

func FaultConfigTargetCountMismatch

func FaultConfigTargetCountMismatch(curIdx, curCount, seenIdx, seenCount int) *fault.Fault

func GetAccessPointPort

func GetAccessPointPort(log logging.Logger, addr string) (int, error)

GetAccessPointPort returns port number suffixed to AP address after its validation or 0 if no port number specified. Error returned if validation fails.

Types

type EngineAffinityFn

type EngineAffinityFn func(logging.Logger, *engine.Config) (uint, error)

EngineAffinityFn defines a function which returns the NUMA node affinity of a given engine.

type Server

type Server struct {
	// control-specific
	ControlPort       int                       `yaml:"port"`
	TransportConfig   *security.TransportConfig `yaml:"transport_config"`
	Engines           []*engine.Config          `yaml:"engines"`
	BdevExclude       []string                  `yaml:"bdev_exclude,omitempty"`
	DisableVFIO       bool                      `yaml:"disable_vfio"`
	DisableVMD        *bool                     `yaml:"disable_vmd"`
	EnableHotplug     bool                      `yaml:"enable_hotplug"`
	NrHugepages       int                       `yaml:"nr_hugepages"`        // total for all engines
	SystemRamReserved int                       `yaml:"system_ram_reserved"` // total for all engines
	DisableHugepages  bool                      `yaml:"disable_hugepages"`
	ControlLogMask    common.ControlLogLevel    `yaml:"control_log_mask"`
	ControlLogFile    string                    `yaml:"control_log_file,omitempty"`
	ControlLogJSON    bool                      `yaml:"control_log_json,omitempty"`
	HelperLogFile     string                    `yaml:"helper_log_file,omitempty"`
	FWHelperLogFile   string                    `yaml:"firmware_helper_log_file,omitempty"`
	FaultPath         string                    `yaml:"fault_path,omitempty"`
	TelemetryPort     int                       `yaml:"telemetry_port,omitempty"`
	CoreDumpFilter    uint8                     `yaml:"core_dump_filter,omitempty"`
	ClientEnvVars     []string                  `yaml:"client_env_vars,omitempty"`

	// duplicated in engine.Config
	SystemName string              `yaml:"name"`
	SocketDir  string              `yaml:"socket_dir"`
	Fabric     engine.FabricConfig `yaml:",inline"`
	Modules    string              `yaml:"-"`

	AccessPoints []string `yaml:"access_points"`

	Metadata storage.ControlMetadata `yaml:"control_metadata,omitempty"`

	// unused (?)
	FaultCb      string `yaml:"fault_cb"`
	Hyperthreads bool   `yaml:"hyperthreads"`

	Path string `yaml:"-"` // path to config file

	// Legacy config file parameters stored in a separate struct.
	Legacy ServerLegacy `yaml:",inline"`

	// Behavior flags
	AutoFormat bool `yaml:"-"`
}

Server describes configuration options for DAOS control plane. See utils/config/daos_server.yml for parameter descriptions.

func DefaultServer

func DefaultServer() *Server

DefaultServer creates a new instance of configuration struct populated with defaults.

func (*Server) CalcMemForRamdiskSize

func (cfg *Server) CalcMemForRamdiskSize(log logging.Logger, hpSizeKiB int, ramdiskSize uint64) (uint64, error)

CalcMemForRamdiskSize calculates minimum memory needed for a given RAM-disk size.

func (*Server) CalcRamdiskSize

func (cfg *Server) CalcRamdiskSize(log logging.Logger, hpSizeKiB, memKiB int) (uint64, error)

CalcRamdiskSize calculates possible RAM-disk size using nr hugepages from config and total memory.

func (*Server) Load

func (cfg *Server) Load() error

Load reads the serialized configuration from disk and validates file syntax.

func (*Server) SaveActiveConfig

func (cfg *Server) SaveActiveConfig(log logging.Logger)

SaveActiveConfig saves read-only active config, tries config dir then /tmp/.

func (*Server) SaveToFile

func (cfg *Server) SaveToFile(filename string) error

SaveToFile serializes the configuration and saves it to the specified filename.

func (*Server) SetEngineAffinities

func (cfg *Server) SetEngineAffinities(log logging.Logger, affSources ...EngineAffinityFn) error

SetEngineAffinities sets the NUMA node affinity for all engines in the configuration.

func (*Server) SetNrHugepages

func (cfg *Server) SetNrHugepages(log logging.Logger, mi *common.MemInfo) error

SetNrHugepages calculates minimum based on total target count if using nvme.

func (*Server) SetPath

func (cfg *Server) SetPath(inPath string) error

SetPath sets the default path to the configuration file.

func (*Server) SetRamdiskSize

func (cfg *Server) SetRamdiskSize(log logging.Logger, mi *common.MemInfo) error

SetRamdiskSize calculates maximum RAM-disk size using total memory as reported by /proc/meminfo. Then either validate configured engine storage values or assign if not already set.

func (*Server) Validate

func (cfg *Server) Validate(log logging.Logger) (err error)

Validate asserts that config meets minimum requirements.

func (*Server) WithAccessPoints

func (cfg *Server) WithAccessPoints(aps ...string) *Server

WithAccessPoints sets the access point list.

func (*Server) WithBdevExclude

func (cfg *Server) WithBdevExclude(bList ...string) *Server

WithBdevExclude sets the block device exclude list.

func (*Server) WithClientEnvVars

func (cfg *Server) WithClientEnvVars(envVars []string) *Server

WithClientEnvVars sets the environment variables to be sent to the client.

func (*Server) WithControlLogFile

func (cfg *Server) WithControlLogFile(filePath string) *Server

WithControlLogFile sets the path to the daos_server logfile.

func (*Server) WithControlLogJSON

func (cfg *Server) WithControlLogJSON(enabled bool) *Server

WithControlLogJSON enables or disables JSON output.

func (*Server) WithControlLogMask

func (cfg *Server) WithControlLogMask(lvl common.ControlLogLevel) *Server

WithControlLogMask sets the daos_server log level.

func (*Server) WithControlMetadata

func (cfg *Server) WithControlMetadata(md storage.ControlMetadata) *Server

WithControlMetadata sets the control plane metadata.

func (*Server) WithControlPort

func (cfg *Server) WithControlPort(port int) *Server

WithControlPort sets the gRPC listener port.

func (*Server) WithCoreDumpFilter

func (cfg *Server) WithCoreDumpFilter(filter uint8) *Server

WithCoreDumpFilter sets the core dump filter written to /proc/self/coredump_filter.

func (*Server) WithCrtTimeout

func (cfg *Server) WithCrtTimeout(timeout uint32) *Server

WithCrtTimeout sets the top-level CrtTimeout.

func (*Server) WithDisableHugepages

func (cfg *Server) WithDisableHugepages(disabled bool) *Server

WithDisableHugepages disables the use of huge pages.

func (*Server) WithDisableVFIO

func (cfg *Server) WithDisableVFIO(disabled bool) *Server

WithDisableVFIO indicates that the vfio-pci driver should not be used by SPDK even if an IOMMU is detected. Note that this option requires that DAOS be run as root.

func (*Server) WithDisableVMD

func (cfg *Server) WithDisableVMD(disabled bool) *Server

WithDisableVMD can be used to set the state of VMD functionality, if disabled then VMD devices will not be used if they exist.

func (*Server) WithEnableHotplug

func (cfg *Server) WithEnableHotplug(enabled bool) *Server

WithEnableHotplug can be used to enable hotplug

func (*Server) WithEngines

func (cfg *Server) WithEngines(engineList ...*engine.Config) *Server

WithEngines sets the list of engine configurations.

func (*Server) WithFabricAuthKey

func (cfg *Server) WithFabricAuthKey(key string) *Server

WithFabricAuthKey sets the top-level fabric authorization key.

func (*Server) WithFabricProvider

func (cfg *Server) WithFabricProvider(provider string) *Server

WithFabricProvider sets the top-level fabric provider.

func (*Server) WithFaultCb

func (cfg *Server) WithFaultCb(cb string) *Server

WithFaultCb sets the path to the fault callback script.

func (*Server) WithFaultPath

func (cfg *Server) WithFaultPath(fp string) *Server

WithFaultPath sets the fault path (identification string e.g. rack/shelf/node).

func (*Server) WithFirmwareHelperLogFile

func (cfg *Server) WithFirmwareHelperLogFile(filePath string) *Server

WithFirmwareHelperLogFile sets the path to the daos_firmware_helper logfile.

func (*Server) WithHelperLogFile

func (cfg *Server) WithHelperLogFile(filePath string) *Server

WithHelperLogFile sets the path to the daos_server_helper logfile.

func (*Server) WithHyperthreads

func (cfg *Server) WithHyperthreads(enabled bool) *Server

WithHyperthreads enables or disables hyperthread support.

func (*Server) WithModules

func (cfg *Server) WithModules(mList string) *Server

WithModules sets a list of server modules to load.

func (*Server) WithNrHugepages

func (cfg *Server) WithNrHugepages(nr int) *Server

WithNrHugepages sets the number of huge pages to be used (total for all engines).

func (*Server) WithNumSecondaryEndpoints

func (cfg *Server) WithNumSecondaryEndpoints(nr []int) *Server

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

func (*Server) WithSocketDir

func (cfg *Server) WithSocketDir(sockDir string) *Server

WithSocketDir sets the default socket directory.

func (*Server) WithSystemName

func (cfg *Server) WithSystemName(name string) *Server

WithSystemName sets the system name.

func (*Server) WithSystemRamReserved

func (cfg *Server) WithSystemRamReserved(nr int) *Server

WithSystemRamReserved sets the amount of system memory to reserve for system (non-DAOS) use. In units of GiB.

func (*Server) WithTelemetryPort

func (cfg *Server) WithTelemetryPort(port int) *Server

WithTelemetryPort sets the port for the telemetry exporter.

func (*Server) WithTransportConfig

func (cfg *Server) WithTransportConfig(cfgTransport *security.TransportConfig) *Server

WithTransportConfig sets the gRPC transport configuration.

type ServerLegacy

type ServerLegacy struct {
	// Detect outdated "enable_vmd" config parameter and direct users to update config file.
	EnableVMD *bool `yaml:"enable_vmd,omitempty"`
	// Detect outdated "servers" config, to direct users to change their config file.
	Servers []*engine.Config `yaml:"servers,omitempty"`
	// Detect outdated "recreate_superblocks" config, to direct users to change their config file.
	RecreateSuperblocks bool `yaml:"recreate_superblocks,omitempty"`
}

ServerLegacy describes old configuration options that should be supported for backward compatibility and may be deprecated in future releases. See utils/config/daos_server.yml for parameter descriptions.

func (*ServerLegacy) WithEnableVMD

func (sl *ServerLegacy) WithEnableVMD(enabled bool) *ServerLegacy

WithEnableVMD can be used to set the state of VMD functionality, if not enabled then VMD devices will not be used if they exist.

func (*ServerLegacy) WithRecreateSuperblocks

func (sl *ServerLegacy) WithRecreateSuperblocks() *ServerLegacy

WithRecreateSuperblocks indicates that a missing superblock should not be treated as an error. The server will create new superblocks as necessary.

Jump to

Keyboard shortcuts

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