note

package
v0.0.0-...-883cb22 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INISectionSysctl    = "sysctl"
	INISectionVM        = "vm"
	INISectionCPU       = "cpu"
	INISectionMEM       = "mem"
	INISectionBlock     = "block"
	INISectionService   = "service"
	INISectionLimits    = "limits"
	INISectionLogin     = "login"
	INISectionVersion   = "version"
	INISectionPagecache = "pagecache"
	INISectionRpm       = "rpm"
	INISectionGrub      = "grub"
	INISectionReminder  = "reminder"
	SysKernelTHPEnabled = "kernel/mm/transparent_hugepage/enabled"
	SysKSMRun           = "kernel/mm/ksm/run"

	// LoginConfDir is the path to systemd's logind configuration directory under /etc.
	LogindConfDir = "/etc/systemd/logind.conf.d"
	// LogindSAPConfFile is a configuration file full of SAP-specific settings for logind.
	LogindSAPConfFile = "saptune-UserTasksMax.conf"
)

section name definition

View Source
const OverrideTuningSheets = "/etc/saptune/override/"

OverrideTuningSheets defines saptunes override directory

View Source
const SaptuneParameterStateDir = "/var/lib/saptune/parameter"

SaptuneParameterStateDir defines the directory where to store the parameter state files separated from the note state file directory

View Source
const SaptuneSectionDir = "/var/lib/saptune/sections"

SaptuneSectionDir defines saptunes saved state directory

Variables

This section is empty.

Functions

func AddParameterNoteValues

func AddParameterNoteValues(param, value, noteID string)

AddParameterNoteValues adds note parameter values to the state file.

func CalculateOptimumValue

func CalculateOptimumValue(operator txtparser.Operator, currentValue string, expectedValue string) (string, error)

CalculateOptimumValue calculates optimum parameter value given the current value, comparison operator, and expected value. Return optimised value.

func CleanUpParamFile

func CleanUpParamFile(param string)

CleanUpParamFile removes the parameter state file

func CleanUpRun

func CleanUpRun()

CleanUpRun cleans up runtime files

func CompareJSValue

func CompareJSValue(v1, v2 interface{}, op string) (v1JS, v2JS string, match bool)

CompareJSValue compares JSON representation of two values and see if they match.

func CompareNoteFields

func CompareNoteFields(actualNote, expectedNote Note) (allMatch bool, comparisons map[string]FieldComparison, valApplyList []string)

CompareNoteFields compares the content of two notes and return differences in their fields in a human-readable text.

func CreateParameterStartValues

func CreateParameterStartValues(param, value string)

CreateParameterStartValues creates the parameter state file and inserts the start values.

func GetAllSavedParameters

func GetAllSavedParameters() map[string]ParameterNotes

GetAllSavedParameters reads all saved parameters from the state directory fill structure app.AllParameters

func GetBlkVal

func GetBlkVal(key string, cur *param.BlockDeviceQueue) (string, string, error)

GetBlkVal initialise the block device structure with the current system settings

func GetCPUVal

func GetCPUVal(key string) (string, string, string)

GetCPUVal initialise the cpu performance structure with the current system settings

func GetGrubVal

func GetGrubVal(key string) string

GetGrubVal initialise the grub structure with the current system settings

func GetLimitsVal

func GetLimitsVal(value string) (string, error)

GetLimitsVal initialise the security limit structure with the current system settings

func GetLoginVal

func GetLoginVal(key string) (string, error)

GetLoginVal initialise the systemd login structure with the current system settings

func GetMemVal

func GetMemVal(key string) string

GetMemVal initialise the shared memory structure with the current system settings

func GetPagecacheVal

func GetPagecacheVal(key string, cur *LinuxPagingImprovements) string

GetPagecacheVal initialise the pagecache structure with the current system settings

func GetPathToParameter

func GetPathToParameter(param string) string

GetPathToParameter returns path to the serialised parameter state file.

func GetRpmVal

func GetRpmVal(key string) string

GetRpmVal initialise the rpm structure with the current system settings

func GetServiceVal

func GetServiceVal(key string) string

GetServiceVal initialise the systemd service structure with the current system settings

func GetVMVal

func GetVMVal(key string) string

GetVMVal initialise the memory management structure with the current system settings

func IDInParameterList

func IDInParameterList(noteID string, list []ParameterNoteEntry) bool

IDInParameterList checks, if given noteID is already part of the parameter list of notes

func IsLastNoteOfParameter

func IsLastNoteOfParameter(param string) bool

IsLastNoteOfParameter returns true, if there is no parameter state file or false, which means that another note changing the parameter is still applied

func ListParams

func ListParams() (ret []string, err error)

ListParams lists all stored parameter states. Return parameter names

func OptBlkVal

func OptBlkVal(key, cfgval string, cur *param.BlockDeviceQueue, bOK map[string][]string) (string, string)

OptBlkVal optimises the block device structure with the settings from the configuration file

func OptCPUVal

func OptCPUVal(key, actval, cfgval string) string

OptCPUVal optimises the cpu performance structure with the settings from the configuration file

func OptGrubVal

func OptGrubVal(key, cfgval string) string

OptGrubVal returns the value from the configuration file

func OptLimitsVal

func OptLimitsVal(actval, cfgval string) string

OptLimitsVal optimises the security limit structure with the settings from the configuration file or with a calculation

func OptLoginVal

func OptLoginVal(cfgval string) string

OptLoginVal returns the value from the configuration file

func OptMemVal

func OptMemVal(key, actval, cfgval, tmpfspercent string) string

OptMemVal optimises the shared memory structure with the settings from the configuration file or with a calculation

func OptPagecacheVal

func OptPagecacheVal(key, cfgval string, cur *LinuxPagingImprovements) string

OptPagecacheVal optimises the pagecache structure with the settings from the configuration file or with a calculation func OptPagecacheVal(key, cfgval string, cur *LinuxPagingImprovements, keyvalue map[string]map[string]txtparser.INIEntry) string {

func OptRpmVal

func OptRpmVal(key, cfgval string) string

OptRpmVal returns the value from the configuration file

func OptServiceVal

func OptServiceVal(key, cfgval string) string

OptServiceVal optimises the systemd service structure with the settings from the configuration file

func OptSysctlVal

func OptSysctlVal(operator txtparser.Operator, key, actval, cfgval string) string

OptSysctlVal optimises a sysctl parameter value use exactly the value from the config file. No calculation any more

func OptVMVal

func OptVMVal(key, cfgval string) string

OptVMVal optimises the memory management structure with the settings from the configuration file

func PositionInParameterList

func PositionInParameterList(noteID string, list []ParameterNoteEntry) int

PositionInParameterList gets the position in the slice AllNotes for a given noteID return the position of the note within the slice. do not sort the slice

func RevertParameter

func RevertParameter(param, noteID string) (string, string)

RevertParameter reverts parameter values and removes noteID reference from the parameter file return value of parameter and related noteID

func SetBlkVal

func SetBlkVal(key, value string, cur *param.BlockDeviceQueue, revert bool) error

SetBlkVal applies the settings to the system

func SetCPUVal

func SetCPUVal(key, value, noteID, savedStates, oval, info string, revert bool) error

SetCPUVal applies the settings to the system

func SetGrubVal

func SetGrubVal(value string) error

SetGrubVal nothing to do, only checking for 'verify'

func SetLimitsVal

func SetLimitsVal(key, noteID, value string, revert bool) error

SetLimitsVal applies the settings to the system

func SetLoginVal

func SetLoginVal(key, value string, revert bool) error

SetLoginVal applies the settings to the system

func SetMemVal

func SetMemVal(key, value string) error

SetMemVal applies the settings to the system

func SetPagecacheVal

func SetPagecacheVal(key string, cur *LinuxPagingImprovements) error

SetPagecacheVal applies the settings to the system

func SetRpmVal

func SetRpmVal(value string) error

SetRpmVal nothing to do, only checking for 'verify'

func SetServiceVal

func SetServiceVal(key, value string) error

SetServiceVal applies the settings to the system

func SetVMVal

func SetVMVal(key, value string) error

SetVMVal applies the settings to the system

func StoreParameter

func StoreParameter(param string, obj ParameterNotes, overwriteExisting bool) error

StoreParameter stores parameter values to state directory Write a json file with the name of the given parameter containing the applied noteIDs for this parameter and the associated parameter values

Types

type FieldComparison

type FieldComparison struct {
	ReflectFieldName               string // Structure field name
	ReflectMapKey                  string // If structure field is a map, this is the map key
	ActualValue, ExpectedValue     interface{}
	ActualValueJS, ExpectedValueJS string
	MatchExpectation               bool
}

FieldComparison records the actual value versus expected value for a note field. The field name has to be the actual name in Go struct.

type INISettings

type INISettings struct {
	ConfFilePath    string            // Full path to the 3rd party vendor's tuning configuration file
	ID              string            // ID portion of the tuning configuration
	DescriptiveName string            // Descriptive name portion of the tuning configuration
	SysctlParams    map[string]string // Sysctl parameter values from the computer system
	ValuesToApply   map[string]string // values to apply
	OverrideParams  map[string]string // parameter values from the override file
	Inform          map[string]string // special information for parameter values
}

INISettings defines tuning options composed by a third party vendor.

func (INISettings) Apply

func (vend INISettings) Apply() error

Apply sets the new parameter values in the system or revert the system to the former parameter values

func (INISettings) Initialise

func (vend INISettings) Initialise() (Note, error)

Initialise retrieves the current parameter values from the system

func (INISettings) Name

func (vend INISettings) Name() string

Name returns the name of the related SAP Note or en empty string

func (INISettings) Optimise

func (vend INISettings) Optimise() (Note, error)

Optimise gets the expected parameter values from the configuration

func (INISettings) SetValuesToApply

func (vend INISettings) SetValuesToApply(values []string) Note

SetValuesToApply fills the data structure for applying the changes

type LinuxPagingImprovements

type LinuxPagingImprovements struct {
	PagingConfig string // configuration file for page cache, used by test cases and during optimise

	VMPagecacheLimitMB          uint64
	VMPagecacheLimitIgnoreDirty int
	UseAlgorithmForHANA         bool
}

LinuxPagingImprovements defines SAP Note 1557506 1557506 - Linux paging improvements

func (LinuxPagingImprovements) Apply

func (paging LinuxPagingImprovements) Apply() error

Apply sets the new values in the system

func (LinuxPagingImprovements) Initialise

func (paging LinuxPagingImprovements) Initialise() (Note, error)

Initialise reads the parameter values from current system

func (LinuxPagingImprovements) Name

func (paging LinuxPagingImprovements) Name() string

Name returns the name of the related SAP Note

func (LinuxPagingImprovements) Optimise

func (paging LinuxPagingImprovements) Optimise() (Note, error)

Optimise gets the expected pagecache values from the configuration or calculates new values

type Note

type Note interface {
	Initialise() (Note, error) // Inspect all tuning parameters and return.
	Optimise() (Note, error)   // (Re)calculate all parameters, but do not apply.
	Apply() error              // Apply all tuning parameters without further calculation.
	Name() string              // The original note name.
}

Note defines the structure and actions for a SAP Note An SAP note consisting of a series of tunable parameters that can be applied and reverted. Parameter is immutable. Internal state changes can only be made to copies.

type ParameterNoteEntry

type ParameterNoteEntry struct {
	NoteID string
	Value  string
}

ParameterNoteEntry stores the parameter values set by a Note

type ParameterNotes

type ParameterNotes struct {
	AllNotes []ParameterNoteEntry
}

ParameterNotes includes a list of applied notes, which manipulate the given system parameter the entries are stored in exactly the order the Notes were applied. So you get a (timeline) chain of applied parameter values

func GetSavedParameterNotes

func GetSavedParameterNotes(param string) ParameterNotes

GetSavedParameterNotes reads content of stored parameter states. Return the content as ParameterNotes

type TuningOptions

type TuningOptions map[string]Note

TuningOptions is the collection of tuning options from SAP notes and 3rd party vendors.

func GetTuningOptions

func GetTuningOptions(saptuneTuningDir, thirdPartyTuningDir string) TuningOptions

GetTuningOptions returns all built-in tunable SAP notes together with those defined by 3rd party vendors.

func (*TuningOptions) GetSortedIDs

func (opts *TuningOptions) GetSortedIDs() (ret []string)

GetSortedIDs returns all tuning option IDs, sorted in ascending order.

Jump to

Keyboard shortcuts

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