Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateSize(conf string, storages []*BaremetalStorage) int64
- func CheckDisksAllocable(layouts []Layout, disks []*Disk) bool
- func GetMinDiskRequirement(diskConfig string) int
- func GetSplitSizes(size int64, splitConf string) []int64
- func GetStoragesMinSize(ss []*BaremetalStorage) int64
- func MeetConfig(conf *BaremetalDiskConfig, storages []*BaremetalStorage) error
- func ParseRange(rangeStr string) (ret []int64, err error)
- func RequireEvenDisks(diskConfig string) bool
- func RetrieveStorageDrivers(storages []*BaremetalStorage) sets.String
- type BaremetalDiskConfig
- type BaremetalStorage
- type Disk
- type DiskAdapterSpecs
- type DiskDriverSpecs
- type DiskSpec
- type Layout
- type SpecSizeCount
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 ( BaremetalDefaultDiskConfig = BaremetalDiskConfig{ Type: DISK_TYPE_HYBRID, Conf: DISK_CONF_NONE, Count: 0, } DISK_CONFS = sets.NewString( DISK_CONF_RAID0, DISK_CONF_RAID1, DISK_CONF_RAID5, DISK_CONF_RAID10, DISK_CONF_NONE, ) DISK_TYPES = sets.NewString( DISK_TYPE_ROTATE, DISK_TYPE_SSD, DISK_TYPE_HYBRID, ) DISK_DRIVERS_RAID = sets.NewString( DISK_DRIVER_MEGARAID, DISK_DRIVER_HPSARAID, DISK_DRIVER_MPT2SAS, DISK_DRIVER_MARVELRAID, ) DISK_DRIVERS = sets.NewString( DISK_DRIVER_LINUX, DISK_DRIVER_PCIE).Union(DISK_DRIVERS_RAID) )
Functions ¶
func CalculateSize ¶
func CalculateSize(conf string, storages []*BaremetalStorage) int64
func CheckDisksAllocable ¶
func GetMinDiskRequirement ¶
func GetSplitSizes ¶
func GetStoragesMinSize ¶
func GetStoragesMinSize(ss []*BaremetalStorage) int64
func MeetConfig ¶
func MeetConfig( conf *BaremetalDiskConfig, storages []*BaremetalStorage, ) error
func ParseRange ¶
func RequireEvenDisks ¶
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"` Size []int64 `json:"size"` 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 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 ¶
type SpecSizeCount ¶
Click to show internal directories.
Click to hide internal directories.