baremetal

package
v2.1.21+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: Apache-2.0 Imports: 9 Imported by: 27

Documentation

Index

Constants

View Source
const (
	DISK_CONF_RAID0  = "raid0"
	DISK_CONF_RAID1  = "raid1"
	DISK_CONF_RAID5  = "raid5"
	DISK_CONF_RAID10 = "raid10"
	DISK_CONF_NONE   = "none"

	DEFAULT_DISK_CONF = DISK_CONF_NONE

	DISK_TYPE_ROTATE = "rotate"
	DISK_TYPE_SSD    = "ssd"
	DISK_TYPE_HYBRID = "hybrid"

	DEFAULT_DISK_TYPE = DISK_TYPE_ROTATE

	DISK_DRIVER_MEGARAID   = "MegaRaid"
	DISK_DRIVER_LINUX      = "Linux"
	DISK_DRIVER_HPSARAID   = "HPSARaid"
	DISK_DRIVER_MPT2SAS    = "Mpt2SAS"
	DISK_DRIVER_MARVELRAID = "MarvelRaid"
	DISK_DRIVER_PCIE       = "PCIE"

	HDD_DISK_SPEC_TYPE = "HDD"
	SSD_DISK_SPEC_TYPE = "SSD"
)

Variables

View Source
var (
	ErrMoreThanOneSizeUnspecificSplit = errors.New(`more than 1 size unspecific split`)
	ErrNoMoreSpaceForUnspecificSplit  = errors.New(`no more space for an unspecific split`)
	ErrSubtotalOfSplitExceedsDiskSize = errors.New(`subtotal of split exceeds disk size`)
)

Functions

func CalculateSize

func CalculateSize(conf string, storages []*BaremetalStorage) int64

func CheckDisksAllocable

func CheckDisksAllocable(layouts []Layout, disks []*Disk) bool

func GetMinDiskRequirement

func GetMinDiskRequirement(diskConfig string) int

func GetSplitSizes

func GetSplitSizes(size int64, splitConf string) []int64

func GetStoragesMinSize

func GetStoragesMinSize(ss []*BaremetalStorage) int64

func MeetConfig

func MeetConfig(
	conf *BaremetalDiskConfig,
	storages []*BaremetalStorage,
) error

func ParseRange

func ParseRange(rangeStr string) (ret []int64, err error)

func RequireEvenDisks

func RequireEvenDisks(diskConfig string) bool

func RetrieveStorageDrivers

func RetrieveStorageDrivers(storages []*BaremetalStorage) sets.String

Types

type BaremetalDiskConfig

type BaremetalDiskConfig struct {
	// disk type
	Type string `json:"type"`
	// raid config
	Conf         string  `json:"conf"`
	Count        int64   `json:"count"`
	Range        []int64 `json:"range"`
	Splits       string  `json:"splits"`
	Adapter      *int    `json:"adapter"`
	Driver       string  `json:"driver"`
	Cachedbadbbu bool    `json:"cachedbadbbu"`
	Strip        int64   `json:"strip"`
	RA           bool    `json:"ra"`
	WT           bool    `json:"wt"`
	Direct       bool    `json:"direct"`
}

func NewBaremetalDiskConfigs

func NewBaremetalDiskConfigs(dss ...string) ([]*BaremetalDiskConfig, error)

func ParseDiskConfig

func ParseDiskConfig(desc string) (bdc BaremetalDiskConfig, err error)

type BaremetalStorage

type BaremetalStorage struct {
	Slot         int    `json:"slot"`
	Status       string `json:"status"`
	Rotate       bool   `json:"rotate"`
	Adapter      int    `json:"adapter"`
	Driver       string `json:"driver"`
	Model        string `json:"model"`
	Enclosure    int    `json:"enclousure"`
	Size         int64  `json:"size"`
	MinStripSize int64  `json:"min_strip_size,omitempty"`
	MaxStripSize int64  `json:"max_strip_size,omitempty"`
	Index        int64  `json:"index"`
}

func RetrieveStorages

func RetrieveStorages(diskConfig *BaremetalDiskConfig, storages []*BaremetalStorage) (selected, rest []*BaremetalStorage)

type Disk

type Disk struct {
	Backend         string  `json:"backend"`
	ImageID         string  `json:"image_id"`
	Fs              *string `json:"fs"`
	Os              string  `json:"os"`
	OSDistribution  string  `json:"os_distribution"`
	OsVersion       string  `json:"os_version"`
	Format          string  `json:"format"`
	MountPoint      *string `json:"mountpoint"`
	Driver          *string `json:"driver"`
	Cache           *string `json:"cache"`
	ImageDiskFormat string  `json:"image_disk_format"`
	Size            int64   `json:"size"`
	Storage         *string `json:"storage"`
}

type DiskAdapterSpecs

type DiskAdapterSpecs map[string]DiskSpec

type DiskDriverSpecs

type DiskDriverSpecs map[string]DiskAdapterSpecs

func GetDiskSpecV2

func GetDiskSpecV2(storages []*BaremetalStorage) DiskDriverSpecs

type DiskSpec

type DiskSpec map[string]SpecSizeCount

func GetDiskSpec

func GetDiskSpec(storages []*BaremetalStorage) DiskSpec

type Layout

type Layout struct {
	Disks []*BaremetalStorage  `json:"disks"`
	Conf  *BaremetalDiskConfig `json:"conf"`
	Size  int64                `json:"size"`
}

func CalculateLayout

func CalculateLayout(
	confs []*BaremetalDiskConfig,
	storages []*BaremetalStorage,
) (layouts []Layout, err error)

func ExpandNoneConf

func ExpandNoneConf(layouts []Layout) (ret []Layout)

func (Layout) String

func (l Layout) String() string

type SpecSizeCount

type SpecSizeCount map[string]int

Jump to

Keyboard shortcuts

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