mpathconfig

package
v4.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NEWLINE indicates new line character
	NEWLINE = "\n"
	// MPATHCONF indicates configuration file path for multipathd
	MPATHCONF = "/etc/multipath.conf"
	// SectionNotFoundError represents error when section with given name is not found in config
	SectionNotFoundError = "unable to find section"
	// NimbleBackupSuffix common suffix for all file backups
	NimbleBackupSuffix = "nimblebackup"
)

Variables

This section is empty.

Functions

func IsUserFriendlyNamesEnabled

func IsUserFriendlyNamesEnabled() (bool, error)

IsUserFriendlyNamesEnabled returns true if user_friendly_names is enabled

func SaveConfig

func SaveConfig(config *Configuration, filePath string) (err error)

SaveConfig writes corrected config to file after taking backup

func TakeBackupOfConfFile

func TakeBackupOfConfFile(srcFile string, backupSuffix string) (err error)

TakeBackupOfConfFile take a backup of srcFile after taking backup in same directory with suffix and timestamp appended

Types

type Configuration

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

Configuration represents entire multipath.conf along with all sections

func ParseConfig

func ParseConfig(filePath string) (config *Configuration, err error)

ParseConfig reads and parses give config file into sections

func (*Configuration) AddSection

func (config *Configuration) AddSection(sectionName string, parent *Section) (section *Section, err error)

AddSection adds a new section into config

func (*Configuration) GetNimbleSection

func (config *Configuration) GetNimbleSection() (section *Section, err error)

GetNimbleSection gets nimble device section in /etc/multipath.conf

func (*Configuration) GetRoot

func (config *Configuration) GetRoot() *Section

GetRoot returns the root section

func (*Configuration) GetSection

func (config *Configuration) GetSection(sectionName, vendor string) (section *Section, err error)

GetSection returns section with matching name

func (*Configuration) PrintConf

func (config *Configuration) PrintConf() (conf []string)

PrintConf returns the string representation of current section and all child sections

type Duplicate

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

Duplicate manages duplicate params with same key in defaults section

type Section

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

Section represents a multipath.conf section embedded between { and }

func GetDefaultsSection

func GetDefaultsSection() (defaults *Section, err error)

GetDefaultsSection returns defaults{} section from multipath.conf

func (*Section) GetChildren

func (section *Section) GetChildren() *list.List

GetChildren returns the list of child sections

func (*Section) GetName

func (section *Section) GetName() string

GetName returns the name of the section

func (*Section) GetParent

func (section *Section) GetParent() *Section

GetParent returns the parent section

func (*Section) GetProperties

func (section *Section) GetProperties() map[string]string

GetProperties returns the key value properties in current section

func (*Section) PrintSection

func (section *Section) PrintSection(indent int) (conf []string)

PrintSection returns each section in string format

func (*Section) SetParent

func (section *Section) SetParent(parent *Section)

SetParent sets parent of section

Jump to

Keyboard shortcuts

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