baremetal

package
v0.3.9-9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 11 Imported by: 27

Documentation

Index

Constants

View Source
const (
	DISK_CONF_RAID0  = api.DISK_CONF_RAID0
	DISK_CONF_RAID1  = api.DISK_CONF_RAID1
	DISK_CONF_RAID5  = api.DISK_CONF_RAID5
	DISK_CONF_RAID10 = api.DISK_CONF_RAID10
	DISK_CONF_NONE   = api.DISK_CONF_NONE

	DEFAULT_DISK_CONF = api.DEFAULT_DISK_CONF

	DISK_TYPE_ROTATE = api.DISK_TYPE_ROTATE
	DISK_TYPE_SSD    = api.DISK_TYPE_SSD
	DISK_TYPE_HYBRID = api.DISK_TYPE_HYBRID

	DEFAULT_DISK_TYPE = api.DEFAULT_DISK_TYPE

	DISK_DRIVER_MEGARAID    = api.DISK_DRIVER_MEGARAID
	DISK_DRIVER_LINUX       = api.DISK_DRIVER_LINUX
	DISK_DRIVER_HPSARAID    = api.DISK_DRIVER_HPSARAID
	DISK_DRIVER_MPT2SAS     = api.DISK_DRIVER_MPT2SAS
	DISK_DRIVER_MARVELRAID  = api.DISK_DRIVER_MARVELRAID
	DISK_DRIVER_ADAPTECRAID = api.DISK_DRIVER_ADAPTECRAID
	DISK_DRIVER_PCIE        = api.DISK_DRIVER_PCIE

	HDD_DISK_SPEC_TYPE = api.HDD_DISK_SPEC_TYPE
	SSD_DISK_SPEC_TYPE = api.SSD_DISK_SPEC_TYPE
)

Variables

View Source
var (
	BaremetalDefaultDiskConfig = api.BaremetalDefaultDiskConfig

	DISK_CONFS = api.DISK_CONFS

	DISK_TYPES = api.DISK_TYPES

	DISK_DRIVERS_RAID = api.DISK_DRIVERS_RAID

	DISK_DRIVERS = api.DISK_DRIVERS
)
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 []*api.DiskConfig) (bool, []*api.DiskConfig)

func GetDiskSpecV2

func GetDiskSpecV2(storages []*BaremetalStorage) api.DiskDriverSpec

func GetDiskSpecs

func GetDiskSpecs(storages []*BaremetalStorage) []*api.DiskSpec

func GetLayoutDiskConfig

func GetLayoutDiskConfig(layouts []Layout) []*api.BaremetalDiskConfig

func GetLayoutRaidConfig

func GetLayoutRaidConfig(layouts []Layout) []*api.BaremetalDiskConfig

func GetMinDiskRequirement

func GetMinDiskRequirement(diskConfig string) int

func GetSplitSizes

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

func GetStoragesMinSize

func GetStoragesMinSize(ss []*BaremetalStorage) int64

func IsDiskSpecSameAs

func IsDiskSpecSameAs(ds *api.DiskSpec, s *BaremetalStorage, index int) bool

func IsDisksAllocable

func IsDisksAllocable(layouts []Layout, disks []*api.DiskConfig) bool

func MeetConfig

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

func NewBaremetalDiskConfigs

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

func NewDiskSpec

func NewDiskSpec(s *BaremetalStorage, index int) *api.DiskSpec

func ParseDiskConfig

func ParseDiskConfig(desc string) (api.BaremetalDiskConfig, error)

func RequireEvenDisks

func RequireEvenDisks(diskConfig string) bool

func RetrieveStorageDrivers

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

func ValidateDiskConfigs

func ValidateDiskConfigs(confs []*api.BaremetalDiskConfig) error

Types

type BaremetalStorage

type BaremetalStorage struct {
	Size         int64  `json:"size,allowzero"`
	Driver       string `json:"driver"`
	Rotate       bool   `json:"rotate,allowfalse"`
	Dev          string `json:"dev,omitempty"`
	Sector       int64  `json:"sector,omitempty"`
	Block        int64  `json:"block,omitempty"`
	ModuleInfo   string `json:"module,omitempty"`
	Kernel       string `json:"kernel,omitempty"`
	PCIClass     string `json:"pci_class,omitempty"`
	Slot         int    `json:"slot,allowzero"`
	Status       string `json:"status,omitempty"`
	Adapter      int    `json:"adapter,allowzero"`
	Model        string `json:"model,omitempty"`
	Enclosure    int    `json:"enclousure,allowzero"`
	MinStripSize int64  `json:"min_strip_size,omitempty"`
	MaxStripSize int64  `json:"max_strip_size,omitempty"`
	Index        int64  `json:"index,allowzero"`
	Addr         string `json:"addr,omitempty"`
}

func RetrieveStorages

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

func (BaremetalStorage) GetBlock

func (s BaremetalStorage) GetBlock() int64

type DiskConfiguration

type DiskConfiguration struct {
	Driver     string
	Adapter    int
	RaidConfig string
	Block      int64
	Size       int64
	DiskType   string
}

func GetDiskConfigurations

func GetDiskConfigurations(layouts []Layout) []DiskConfiguration

type DriverAdapterDiskConfig

type DriverAdapterDiskConfig struct {
	Driver  string
	Adapter int
	Configs []*api.BaremetalDiskConfig
}

func GroupLayoutResultsByDriverAdapter

func GroupLayoutResultsByDriverAdapter(layouts []Layout) []*DriverAdapterDiskConfig

type Layout

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

func CalculateLayout

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

func ExpandNoneConf

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

func (Layout) String

func (l Layout) String() string

Jump to

Keyboard shortcuts

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